diff options
Diffstat (limited to 'lexlua/autoit.lua')
-rw-r--r-- | lexlua/autoit.lua | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lexlua/autoit.lua b/lexlua/autoit.lua index 5bb5752f9..3b6d3ae6a 100644 --- a/lexlua/autoit.lua +++ b/lexlua/autoit.lua @@ -97,12 +97,10 @@ lex:add_rule('function', token(lexer.FUNCTION, word_match([[ lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) -- Comments. -local line_comment = ';' * lexer.nonnewline_esc^0 -local block_comment1 = '#comments-start' * (lexer.any - '#comments-end')^0 * - P('#comments-end')^-1 -local block_comment2 = '#cs' * (lexer.any - '#ce')^0 * P('#ce')^-1 -lex:add_rule('comment', token(lexer.COMMENT, line_comment + block_comment1 + - block_comment2)) +local line_comment = lexer.to_eol(';') +local block_comment = lexer.range('#comments-start', '#comments-end') + + lexer.range('#cs', '#ce') +lex:add_rule('comment', token(lexer.COMMENT, line_comment + block_comment)) -- Preprocessor. lex:add_rule('preprocessor', token(lexer.PREPROCESSOR, '#' * word_match([[ @@ -111,9 +109,9 @@ lex:add_rule('preprocessor', token(lexer.PREPROCESSOR, '#' * word_match([[ ]], true))) -- Strings. -local dq_str = lexer.delimited_range('"', true, true) -local sq_str = lexer.delimited_range("'", true, true) -local inc = lexer.delimited_range('<>', true, true, true) +local dq_str = lexer.range('"', true, false) +local sq_str = lexer.range("'", true, false) +local inc = lexer.range('<', '>', true, false, true) lex:add_rule('string', token(lexer.STRING, dq_str + sq_str + inc)) -- Macros. @@ -124,7 +122,7 @@ lex:add_style('macro', lexer.STYLE_PREPROCESSOR) lex:add_rule('variable', token(lexer.VARIABLE, '$' * (lexer.alnum + '_')^1)) -- Numbers. -lex:add_rule('number', token(lexer.NUMBER, lexer.float + lexer.integer)) +lex:add_rule('number', token(lexer.NUMBER, lexer.number)) -- Operators. lex:add_rule('operator', token(lexer.OPERATOR, S('+-^*/&<>=?:()[]'))) |