aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlua/fortran.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lexlua/fortran.lua')
-rw-r--r--lexlua/fortran.lua20
1 files changed, 9 insertions, 11 deletions
diff --git a/lexlua/fortran.lua b/lexlua/fortran.lua
index a508a9625..e07068833 100644
--- a/lexlua/fortran.lua
+++ b/lexlua/fortran.lua
@@ -11,14 +11,13 @@ local lex = lexer.new('fortran')
lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))
-- Comments.
-local c_comment = lexer.starts_line(S('Cc')) * lexer.nonnewline^0
-local d_comment = lexer.starts_line(S('Dd')) * lexer.nonnewline^0
-local ex_comment = lexer.starts_line('!') * lexer.nonnewline^0
-local ast_comment = lexer.starts_line('*') * lexer.nonnewline^0
-local line_comment = '!' * lexer.nonnewline^0
+local c_comment = lexer.to_eol(lexer.starts_line(S('Cc')))
+local d_comment = lexer.to_eol(lexer.starts_line(S('Dd')))
+local ex_comment = lexer.to_eol(lexer.starts_line('!'))
+local ast_comment = lexer.to_eol(lexer.starts_line('*'))
+local line_comment = lexer.to_eol('!')
lex:add_rule('comment', token(lexer.COMMENT, c_comment + d_comment +
- ex_comment + ast_comment +
- line_comment))
+ ex_comment + ast_comment + line_comment))
-- Keywords.
lex:add_rule('keyword', token(lexer.KEYWORD, word_match([[
@@ -55,15 +54,14 @@ lex:add_rule('type', token(lexer.TYPE, word_match([[
]], true)))
-- Numbers.
-lex:add_rule('number', token(lexer.NUMBER, (lexer.float + lexer.integer) *
- -lexer.alpha))
+lex:add_rule('number', token(lexer.NUMBER, lexer.number * -lexer.alpha))
-- Identifiers.
lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.alnum^1))
-- Strings.
-local sq_str = lexer.delimited_range("'", true, true)
-local dq_str = lexer.delimited_range('"', true, true)
+local sq_str = lexer.range("'", true, false)
+local dq_str = lexer.range('"', true, false)
lex:add_rule('string', token(lexer.STRING, sq_str + dq_str))
-- Operators.