diff options
Diffstat (limited to 'lexlua/cpp.lua')
| -rw-r--r-- | lexlua/cpp.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lexlua/cpp.lua b/lexlua/cpp.lua index b38e0120e..91a04f650 100644 --- a/lexlua/cpp.lua +++ b/lexlua/cpp.lua @@ -46,7 +46,11 @@ local block_comment = '/*' * (lexer.any - '*/')^0 * P('*/')^-1 lex:add_rule('comment', token(lexer.COMMENT, line_comment + block_comment)) -- Numbers. -lex:add_rule('number', token(lexer.NUMBER, lexer.float + lexer.integer)) +local dec = lexer.digit^1 * ("'" * lexer.digit^1)^0 +local hex = '0' * S('xX') * lexer.xdigit^1 * ("'" * lexer.xdigit^1)^0 +local bin = '0' * S('bB') * S('01')^1 * ("'" * S('01')^1)^0 +local integer = S('+-')^-1 * (hex + bin + dec) +lex:add_rule('number', token(lexer.NUMBER, lexer.float + integer)) -- Preprocessor. local preproc_word = word_match[[ |
