aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlua/idl.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lexlua/idl.lua')
-rw-r--r--lexlua/idl.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/lexlua/idl.lua b/lexlua/idl.lua
index f28652a37..83fb65a8c 100644
--- a/lexlua/idl.lua
+++ b/lexlua/idl.lua
@@ -27,23 +27,24 @@ lex:add_rule('type', token(lexer.TYPE, word_match[[
lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word))
-- Strings.
-lex:add_rule('string', token(lexer.STRING, lexer.delimited_range("'", true) +
- lexer.delimited_range('"', true)))
+local sq_str = lexer.range("'", true)
+local dq_str = lexer.range('"', true)
+lex:add_rule('string', token(lexer.STRING, sq_str + dq_str))
-- Comments.
-local line_comment = '//' * lexer.nonnewline_esc^0
-local block_comment = '/*' * (lexer.any - '*/')^0 * P('*/')^-1
+local line_comment = lexer.to_eol('//', true)
+local block_comment = lexer.range('/*', '*/')
lex:add_rule('comment', token(lexer.COMMENT, line_comment + block_comment))
-- Numbers.
-lex:add_rule('number', token(lexer.NUMBER, lexer.float + lexer.integer))
+lex:add_rule('number', token(lexer.NUMBER, lexer.number))
-- Preprocessor.
local preproc_word = word_match[[
define undef ifdef ifndef if elif else endif include warning pragma
]]
lex:add_rule('preproc', token(lexer.PREPROCESSOR, lexer.starts_line('#') *
- preproc_word))
+ preproc_word))
-- Operators.
lex:add_rule('operator', token(lexer.OPERATOR, S('!<>=+-/*%&|^~.,:;?()[]{}')))