diff options
| author | mitchell <unknown> | 2020-04-25 16:26:31 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2020-04-25 16:26:31 -0400 |
| commit | fad15f79b1230b3076be515d6894c8919562809b (patch) | |
| tree | 72c848ef02c3331de5ca54eff7adaea3a9a6fb88 /lexlua/vb.lua | |
| parent | 1fd02a367dec125c0b49dd9246a0928433866b96 (diff) | |
| download | scintilla-mirror-fad15f79b1230b3076be515d6894c8919562809b.tar.gz | |
Reformatted Lua LPeg lexers and added new convenience functions and pattern.
`lexer.range()` replaces `lexer.delimited_range()` and `lexer.nested_pair()`.
`lexer.to_eol()` replaces `patt * lexer.nonnewline^0` constructs.
`lexer.number` replaces `lexer.float + lexer.integer`.
Also added unit tests for lexer functions.
Diffstat (limited to 'lexlua/vb.lua')
| -rw-r--r-- | lexlua/vb.lua | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lexlua/vb.lua b/lexlua/vb.lua index 128cff63e..f85f8f875 100644 --- a/lexlua/vb.lua +++ b/lexlua/vb.lua @@ -33,19 +33,16 @@ lex:add_rule('type', token(lexer.TYPE, word_match([[ -- Comments. lex:add_rule('comment', token(lexer.COMMENT, - (P("'") + word_match([[rem]], true)) * - lexer.nonnewline^0)) + lexer.to_eol("'" + word_match([[rem]], true)))) -- Identifiers. lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) -- Strings. -lex:add_rule('string', token(lexer.STRING, - lexer.delimited_range('"', true, true))) +lex:add_rule('string', token(lexer.STRING, lexer.range('"', true, false))) -- Numbers. -lex:add_rule('number', token(lexer.NUMBER, (lexer.float + lexer.integer) * - S('LlUuFf')^-2)) +lex:add_rule('number', token(lexer.NUMBER, lexer.number * S('LlUuFf')^-2)) -- Operators. lex:add_rule('operator', token(lexer.OPERATOR, S('=><+-*^&:.,_()'))) |
