ui: add support for blink style attribute
[vis.git] / lexers / sass.lua
blob002df271db7a4e695d8d5fe3f702dda484961217
1 -- Copyright 2006-2013 Robert Gieseke. See LICENSE.
2 -- Sass CSS preprocessor LPeg lexer.
3 -- http://sass-lang.com
5 local l = require('lexer')
6 local token = l.token
7 local P, S = lpeg.P, lpeg.S
9 local M = {_NAME = 'sass'}
11 -- Line comments.
12 local line_comment = token(l.COMMENT, '//' * l.nonnewline^0)
14 -- Variables.
15 local variable = token(l.VARIABLE, '$' * (l.alnum + S('_-'))^1)
17 -- Mixins.
18 local mixin = token('mixin', P('@') * l.word)
20 local css = l.load('css')
21 local _rules = css._rules
22 table.insert(_rules, #_rules - 1, {'mixin', mixin})
23 table.insert(_rules, #_rules - 1, {'line_comment', line_comment})
24 table.insert(_rules, #_rules - 1, {'variable', variable})
25 M._rules = _rules
27 M._tokenstyles = css._tokenstyles
28 M._tokenstyles['mixin'] = l.STYLE_FUNCTION
30 M._foldsymbols = css._foldsymbols
32 return M