...

Source file src/github.com/alecthomas/chroma/lexers/i/io.go

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

     1  package i
     2  
     3  import (
     4  	. "github.com/alecthomas/chroma" // nolint
     5  	"github.com/alecthomas/chroma/lexers/internal"
     6  )
     7  
     8  // Io lexer.
     9  var Io = internal.Register(MustNewLazyLexer(
    10  	&Config{
    11  		Name:      "Io",
    12  		Aliases:   []string{"io"},
    13  		Filenames: []string{"*.io"},
    14  		MimeTypes: []string{"text/x-iosrc"},
    15  	},
    16  	ioRules,
    17  ))
    18  
    19  func ioRules() Rules {
    20  	return Rules{
    21  		"root": {
    22  			{`\n`, Text, nil},
    23  			{`\s+`, Text, nil},
    24  			{`//(.*?)\n`, CommentSingle, nil},
    25  			{`#(.*?)\n`, CommentSingle, nil},
    26  			{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil},
    27  			{`/\+`, CommentMultiline, Push("nestedcomment")},
    28  			{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
    29  			{`::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}`, Operator, nil},
    30  			{`(clone|do|doFile|doString|method|for|if|else|elseif|then)\b`, Keyword, nil},
    31  			{`(nil|false|true)\b`, NameConstant, nil},
    32  			{`(Object|list|List|Map|args|Sequence|Coroutine|File)\b`, NameBuiltin, nil},
    33  			{`[a-zA-Z_]\w*`, Name, nil},
    34  			{`(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?`, LiteralNumberFloat, nil},
    35  			{`\d+`, LiteralNumberInteger, nil},
    36  		},
    37  		"nestedcomment": {
    38  			{`[^+/]+`, CommentMultiline, nil},
    39  			{`/\+`, CommentMultiline, Push()},
    40  			{`\+/`, CommentMultiline, Pop(1)},
    41  			{`[+/]`, CommentMultiline, nil},
    42  		},
    43  	}
    44  }
    45  

View as plain text