1package lexers
2
3import (
4 . "github.com/alecthomas/chroma/v2" // nolint
5)
6
7// FortranFixed lexer.
8var 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 {`[\t ]*!.*\n`, Comment, nil},
23 {`(.{5})`, NameLabel, Push("cont-char")},
24 {`.*\n`, Using("Fortran"), nil},
25 },
26 "cont-char": {
27 {` `, Text, Push("code")},
28 {`0`, Comment, Push("code")},
29 {`.`, GenericStrong, Push("code")},
30 },
31 "code": {
32 {`(.{66})(.*)(\n)`, ByGroups(Using("Fortran"), Comment, Text), Push("root")},
33 {`.*\n`, Using("Fortran"), Push("root")},
34 Default(Push("root")),
35 },
36 }
37 },
38))