1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-17 20:58:08 +02:00

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.

This commit is contained in:
smf007 2022-06-20 21:57:12 -04:00 committed by Alec Thomas
parent 9a038fbcb1
commit 298b727472

View File

@ -19,18 +19,18 @@ var FortranFixed = Register(MustNewLexer(
"root": {
{`[C*].*\n`, Comment, nil},
{`#.*\n`, CommentPreproc, nil},
{`[\t ]*!.*\n`, Comment, nil},
{` {0,4}!.*\n`, Comment, nil},
{`(.{5})`, NameLabel, Push("cont-char")},
{`.*\n`, Using("Fortran"), nil},
},
"cont-char": {
{` `, Text, Push("code")},
{`0`, Comment, Push("code")},
{` `, TextWhitespace, Push("code")},
{`.`, GenericStrong, Push("code")},
},
"code": {
{`(.{66})(.*)(\n)`, ByGroups(Using("Fortran"), Comment, Text), Push("root")},
{`.*\n`, Using("Fortran"), Push("root")},
{`(.{66})(.*)(\n)`, ByGroups(Using("Fortran"), Comment, TextWhitespace), Push("root")},
{`(.*)(!.*)(\n)`, ByGroups(Using("Fortran"), Comment, TextWhitespace), Push("root")},
{`(.*)(\n)`, ByGroups(Using("Fortran"), TextWhitespace), Push("root")},
Default(Push("root")),
},
}