...

Source file src/github.com/alecthomas/chroma/lexers/j/jungle.go

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

     1  package j
     2  
     3  import (
     4  	. "github.com/alecthomas/chroma" // nolint
     5  	"github.com/alecthomas/chroma/lexers/internal"
     6  )
     7  
     8  var Jungle = internal.Register(MustNewLazyLexer(
     9  	&Config{
    10  		Name:      "Jungle",
    11  		Aliases:   []string{"jungle"},
    12  		Filenames: []string{"*.jungle"},
    13  		MimeTypes: []string{"text/x-jungle"},
    14  	},
    15  	jungleRules,
    16  ))
    17  
    18  func jungleRules() Rules {
    19  	return Rules{
    20  		"root": {
    21  			{`[^\S\n]+`, Text, nil},
    22  			{`\n`, Text, nil},
    23  			{`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil},
    24  			{`^(?=\S)`, None, Push("instruction")},
    25  			{`[\.;\[\]\(\)\$]`, Punctuation, nil},
    26  			{`[a-zA-Z_]\w*`, Name, nil},
    27  		},
    28  		"instruction": {
    29  			{`[^\S\n]+`, Text, nil},
    30  			{`=`, Operator, Push("value")},
    31  			{`(?=\S)`, None, Push("var")},
    32  			Default(Pop(1)),
    33  		},
    34  		"value": {
    35  			{`[^\S\n]+`, Text, nil},
    36  			{`\$\(`, Punctuation, Push("var")},
    37  			{`[;\[\]\(\)\$]`, Punctuation, nil},
    38  			{`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil},
    39  			{`[\w_\-\.\/\\]+`, Text, nil},
    40  			Default(Pop(1)),
    41  		},
    42  		"var": {
    43  			{`[^\S\n]+`, Text, nil},
    44  			{`\b(((re)?source|barrel)Path|excludeAnnotations|annotations|lang)\b`, NameBuiltin, nil},
    45  			{`\bbase\b`, NameConstant, nil},
    46  			{`\b(ind|zsm|hrv|ces|dan|dut|eng|fin|fre|deu|gre|hun|ita|nob|po[lr]|rus|sl[ov]|spa|swe|ara|heb|zh[st]|jpn|kor|tha|vie|bul|tur)`, NameConstant, nil},
    47  			{`\b((semi)?round|rectangle)(-\d+x\d+)?\b`, NameConstant, nil},
    48  			{`[\.;\[\]\(\$]`, Punctuation, nil},
    49  			{`\)`, Punctuation, Pop(1)},
    50  			{`[a-zA-Z_]\w*`, Name, nil},
    51  			Default(Pop(1)),
    52  		},
    53  	}
    54  }
    55  

View as plain text