diff options
author | mitchell <unknown> | 2018-03-11 23:04:41 -0400 |
---|---|---|
committer | mitchell <unknown> | 2018-03-11 23:04:41 -0400 |
commit | 519b7328b66c4c84f03893a31e4be5ba6b1395f2 (patch) | |
tree | 2055cd79006357e94c185f341d0df17b9a8769eb /lexlua/props.lua | |
parent | c0373e036e965a70045971e2abc582cb4bf12a4e (diff) | |
download | scintilla-mirror-519b7328b66c4c84f03893a31e4be5ba6b1395f2.tar.gz |
Added optional Lua lexer support.
This support is disabled by default and must be enabled via compile-time option.
Diffstat (limited to 'lexlua/props.lua')
-rw-r--r-- | lexlua/props.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lexlua/props.lua b/lexlua/props.lua new file mode 100644 index 000000000..634a54031 --- /dev/null +++ b/lexlua/props.lua @@ -0,0 +1,33 @@ +-- Copyright 2006-2018 Mitchell mitchell.att.foicica.com. See License.txt. +-- Props LPeg lexer. + +local lexer = require('lexer') +local token, word_match = lexer.token, lexer.word_match +local P, R, S = lpeg.P, lpeg.R, lpeg.S + +local lex = lexer.new('props', {lex_by_line = true}) + +-- Whitespace. +lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) + +-- Colors. +lex:add_rule('color', token('color', '#' * lexer.xdigit * lexer.xdigit * + lexer.xdigit * lexer.xdigit * + lexer.xdigit * lexer.xdigit)) +lex:add_style('color', lexer.STYLE_NUMBER) + +-- Comments. +lex:add_rule('comment', token(lexer.COMMENT, '#' * lexer.nonnewline^0)) + +-- Equals. +lex:add_rule('equals', token(lexer.OPERATOR, '=')) + +-- Strings. +lex:add_rule('string', token(lexer.STRING, lexer.delimited_range("'") + + lexer.delimited_range('"'))) + +-- Variables. +lex:add_rule('variable', token(lexer.VARIABLE, '$(' * (lexer.any - ')')^1 * + ')')) + +return lex |