aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlua/batch.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lexlua/batch.lua')
-rw-r--r--lexlua/batch.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/lexlua/batch.lua b/lexlua/batch.lua
index a8dcadda9..314f4cd3a 100644
--- a/lexlua/batch.lua
+++ b/lexlua/batch.lua
@@ -26,19 +26,19 @@ lex:add_rule('function', token(lexer.FUNCTION, word_match([[
]], true)))
-- Comments.
-local rem = (P('REM') + 'rem') * lexer.space
-lex:add_rule('comment', token(lexer.COMMENT, (rem + '::') * lexer.nonnewline^0))
+local rem = (P('REM') + 'rem') * #lexer.space
+lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol(rem + '::')))
-- Identifiers.
lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word))
-- Strings.
-lex:add_rule('string', token(lexer.STRING, lexer.delimited_range('"', true)))
+lex:add_rule('string', token(lexer.STRING, lexer.range('"', true)))
-- Variables.
-lex:add_rule('variable', token(lexer.VARIABLE,
- '%' * (lexer.digit + '%' * lexer.alpha) +
- lexer.delimited_range('%', true, true)))
+local arg = '%' * lexer.digit + '%~' * lexer.alnum^1
+local variable = lexer.range('%', true, false)
+lex:add_rule('variable', token(lexer.VARIABLE, arg + variable))
-- Labels.
lex:add_rule('label', token(lexer.LABEL, ':' * lexer.word))