diff options
Diffstat (limited to 'lexlua/gherkin.lua')
| -rw-r--r-- | lexlua/gherkin.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lexlua/gherkin.lua b/lexlua/gherkin.lua index 2fe38c57d..eedfe3436 100644 --- a/lexlua/gherkin.lua +++ b/lexlua/gherkin.lua @@ -16,26 +16,27 @@ lex:add_rule('keyword', token(lexer.KEYWORD, word_match[[ ]])) -- Strings. -local doc_str = '"""' * (lexer.any - '"""')^0 * P('"""')^-1 -local dq_str = lexer.delimited_range('"') +local doc_str = lexer.range('"""') +local dq_str = lexer.range('"') lex:add_rule('string', token(lexer.STRING, doc_str + dq_str)) -- Comments. -lex:add_rule('comment', token(lexer.COMMENT, '#' * lexer.nonnewline^0)) +lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#'))) -- Numbers. -local number = token(lexer.NUMBER, lexer.float + lexer.integer) +local number = token(lexer.NUMBER, lexer.number) -- Tags. lex:add_rule('tag', token('tag', '@' * lexer.word^0)) lex:add_style('tag', lexer.STYLE_LABEL) -- Placeholders. -lex:add_rule('placeholder', token('placeholder', lexer.nested_pair('<', '>'))) +lex:add_rule('placeholder', token('placeholder', + lexer.range('<', '>', false, false, true))) lex:add_style('placeholder', lexer.STYLE_VARIABLE) -- Examples. -lex:add_rule('example', token('example', '|' * lexer.nonnewline^0)) +lex:add_rule('example', token('example', lexer.to_eol('|'))) lex:add_style('example', lexer.STYLE_NUMBER) return lex |
