Skip to content

Commit 2cc8645

Browse files
ProgramFanalecthomas
authored andcommitted
Add FortranFixedLexer
1 parent 312be63 commit 2cc8645

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Diff for: lexers/f/fortran_fixed.go

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package f
2+
3+
import (
4+
. "github.com/alecthomas/chroma" // nolint
5+
"github.com/alecthomas/chroma/lexers/internal"
6+
)
7+
8+
// FortranFixed lexer.
9+
var FortranFixed = internal.Register(MustNewLazyLexer(
10+
&Config{
11+
Name: "FortranFixed",
12+
Aliases: []string{"fortranfixed"},
13+
Filenames: []string{"*.f", "*.F"},
14+
MimeTypes: []string{"text/x-fortran"},
15+
NotMultiline: true,
16+
CaseInsensitive: true,
17+
},
18+
func() Rules {
19+
return Rules{
20+
"root": {
21+
{`[C*].*\n`, Comment, nil},
22+
{`#.*\n`, CommentPreproc, nil},
23+
{`[\t ]*!.*\n`, Comment, nil},
24+
{`(.{5})`, NameLabel, Push("cont-char")},
25+
{`.*\n`, Using(Fortran), nil},
26+
},
27+
"cont-char": {
28+
{` `, Text, Push("code")},
29+
{`0`, Comment, Push("code")},
30+
{`.`, GenericStrong, Push("code")},
31+
},
32+
"code": {
33+
{`(.{66})(.*)(\n)`, ByGroups(Using(Fortran), Comment, Text), Push("root")},
34+
{`.*\n`, Using(Fortran), Push("root")},
35+
Default(Push("root")),
36+
},
37+
}
38+
},
39+
))

0 commit comments

Comments
 (0)