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/apl.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/apl.lua')
| -rw-r--r-- | lexlua/apl.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lexlua/apl.lua b/lexlua/apl.lua index 285ae0737..ad0ec2d99 100644 --- a/lexlua/apl.lua +++ b/lexlua/apl.lua @@ -12,11 +12,11 @@ lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) -- Comments. lex:add_rule('comment', token(lexer.COMMENT, (P('⍝') + '#') * - lexer.nonnewline^0)) + lexer.nonnewline^0)) -- Strings. -local sq_str = lexer.delimited_range("'", false, true) -local dq_str = lexer.delimited_range('"') +local sq_str = lexer.range("'", false, false) +local dq_str = lexer.range('"') lex:add_rule('string', token(lexer.STRING, sq_str + dq_str)) -- Numbers. @@ -26,12 +26,12 @@ local exp = S('eE') local img = S('jJ') local sgn = P('¯')^-1 local float = sgn * (dig^0 * rad * dig^1 + dig^1 * rad * dig^0 + dig^1) * - (exp * sgn *dig^1)^-1 + (exp * sgn *dig^1)^-1 lex:add_rule('number', token(lexer.NUMBER, float * img * float + float)) -- Keywords. lex:add_rule('keyword', token(lexer.KEYWORD, P('⍞') + 'χ' + '⍺' + '⍶' + '⍵' + - '⍹' + '⎕' * R('AZ', 'az')^0)) + '⍹' + '⎕' * R('AZ', 'az')^0)) -- Names. local n1l = R('AZ', 'az') |
