1 package lexers
2
3 import (
4 . "github.com/alecthomas/chroma/v2"
5 )
6
7
8 var FortranFixed = Register(MustNewLexer(
9 &Config{
10 Name: "FortranFixed",
11 Aliases: []string{"fortranfixed"},
12 Filenames: []string{"*.f", "*.F"},
13 MimeTypes: []string{"text/x-fortran"},
14 NotMultiline: true,
15 CaseInsensitive: true,
16 },
17 func() Rules {
18 return Rules{
19 "root": {
20 {`[C*].*\n`, Comment, nil},
21 {`#.*\n`, CommentPreproc, nil},
22 {` {0,4}!.*\n`, Comment, nil},
23 {`(.{5})`, NameLabel, Push("cont-char")},
24 {`.*\n`, Using("Fortran"), nil},
25 },
26 "cont-char": {
27 {` `, TextWhitespace, Push("code")},
28 {`.`, GenericStrong, Push("code")},
29 },
30 "code": {
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")},
34 Default(Push("root")),
35 },
36 }
37 },
38 ))
39
View as plain text