Skip to content

Commit 298b727

Browse files
smf007alecthomas
authored andcommitted
Revise fortran fixed format lexer to recognize comments using the "!" mark in columns 1-5 and columns > 6. Remove incorrect "0" label being a comment.
1 parent 9a038fb commit 298b727

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lexers/fortran_fixed.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ var FortranFixed = Register(MustNewLexer(
1919
"root": {
2020
{`[C*].*\n`, Comment, nil},
2121
{`#.*\n`, CommentPreproc, nil},
22-
{`[\t ]*!.*\n`, Comment, nil},
22+
{` {0,4}!.*\n`, Comment, nil},
2323
{`(.{5})`, NameLabel, Push("cont-char")},
2424
{`.*\n`, Using("Fortran"), nil},
2525
},
2626
"cont-char": {
27-
{` `, Text, Push("code")},
28-
{`0`, Comment, Push("code")},
27+
{` `, TextWhitespace, Push("code")},
2928
{`.`, GenericStrong, Push("code")},
3029
},
3130
"code": {
32-
{`(.{66})(.*)(\n)`, ByGroups(Using("Fortran"), Comment, Text), Push("root")},
33-
{`.*\n`, Using("Fortran"), Push("root")},
31+
{`(.{66})(.*)(\n)`, ByGroups(Using("Fortran"), Comment, TextWhitespace), Push("root")},
32+
{`(.*)(!.*)(\n)`, ByGroups(Using("Fortran"), Comment, TextWhitespace), Push("root")},
33+
{`(.*)(\n)`, ByGroups(Using("Fortran"), TextWhitespace), Push("root")},
3434
Default(Push("root")),
3535
},
3636
}

0 commit comments

Comments
 (0)