File: io.go

package info (click to toggle)
golang-github-alecthomas-chroma 0.6.3%2Breally0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports
  • size: 2,224 kB
  • sloc: python: 206; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 1,227 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package i

import (
	. "github.com/alecthomas/chroma" // nolint
	"github.com/alecthomas/chroma/lexers/internal"
)

// Io lexer.
var Io = internal.Register(MustNewLexer(
	&Config{
		Name:      "Io",
		Aliases:   []string{"io"},
		Filenames: []string{"*.io"},
		MimeTypes: []string{"text/x-iosrc"},
	},
	Rules{
		"root": {
			{`\n`, Text, nil},
			{`\s+`, Text, nil},
			{`//(.*?)\n`, CommentSingle, nil},
			{`#(.*?)\n`, CommentSingle, nil},
			{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil},
			{`/\+`, CommentMultiline, Push("nestedcomment")},
			{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
			{`::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}`, Operator, nil},
			{`(clone|do|doFile|doString|method|for|if|else|elseif|then)\b`, Keyword, nil},
			{`(nil|false|true)\b`, NameConstant, nil},
			{`(Object|list|List|Map|args|Sequence|Coroutine|File)\b`, NameBuiltin, nil},
			{`[a-zA-Z_]\w*`, Name, nil},
			{`(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?`, LiteralNumberFloat, nil},
			{`\d+`, LiteralNumberInteger, nil},
		},
		"nestedcomment": {
			{`[^+/]+`, CommentMultiline, nil},
			{`/\+`, CommentMultiline, Push()},
			{`\+/`, CommentMultiline, Pop(1)},
			{`[+/]`, CommentMultiline, nil},
		},
	},
))