...

Source file src/github.com/alecthomas/chroma/lexers/f/fortran_fixed.go

Documentation: github.com/alecthomas/chroma/lexers/f

     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  ))
    40  

View as plain text