File: onesenterprise.go

package info (click to toggle)
golang-github-alecthomas-chroma 0.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,652 kB
  • sloc: python: 426; javascript: 79; makefile: 34; sh: 32
file content (50 lines) | stat: -rw-r--r-- 2,631 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
package o

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

// 1S:Enterprise lexer.
var OnesEnterprise = internal.Register(MustNewLazyLexer(
	&Config{
		Name:            "OnesEnterprise",
		Aliases:         []string{"ones", "onesenterprise", "1S", "1S:Enterprise"},
		Filenames:       []string{"*.EPF", "*.epf", "*.ERF", "*.erf"},
		MimeTypes:       []string{"application/octet-stream"},
		CaseInsensitive: true,
	},
	onesRules,
))

func onesRules() Rules {
	return Rules{
		"root": {
			{`\n`, Text, nil},
			{`\s+`, Text, nil},
			{`\\\n`, Text, nil},
			{`[^\S\n]+`, Text, nil},
			{`//(.*?)\n`, Comment, nil},
			{`(#область|#region|#конецобласти|#endregion|#если|#if|#иначе|#else|#конецесли|#endif).*`, CommentPreproc, nil},
			{`(&наклиенте|&atclient|&насервере|&atserver|&насерверебезконтекста|&atservernocontext|&наклиентенасерверебезконтекста|&atclientatservernocontext).*`, CommentPreproc, nil},
			{`(>=|<=|<>|\+|-|=|>|<|\*|/|%)`, Operator, nil},
			{`(;|,|\)|\(|\.)`, Punctuation, nil},
			{Words(``, `\b`, `истина`, `true`, `ложь`, `false`, `и`, `and`, `или`, `or`, `не`, `not`), Operator, nil},
			{Words(``, `\b`, `если`, `if`, `тогда`, `then`, `иначе`, `else`, `иначеесли`, `elsif`, `конецесли`, `endif`), Operator, nil},
			{Words(``, `\b`, `для`, `for`, `каждого`, `each`, `из`, `in`, `цикл`, `do`, `пока`, `while`, `конеццикла`, `enddo`, `по`, `to`), Operator, nil},
			{Words(``, `\b`, `прервать`, `break`, `продолжить`, `continue`, `возврат`, `return`, `перейти`, `goto`), Operator, nil},
			{Words(``, `\b`, `процедура`, `procedure`, `конецпроцедуры`, `endprocedure`, `функция`, `function`, `конецфункции`, `endfunction`), Keyword, nil},
			{Words(``, `\b`, `новый`, `new`, `знач`, `val`, `экспорт`, `export`, `перем`, `var`), Keyword, nil},
			{Words(``, `\b`, `попытка`, `try`, `исключение`, `except`, `вызватьисключение`, `raise`, `конецпопытки`, `endtry`), Keyword, nil},
			{Words(``, `\b`, `выполнить`, `execute`, `вычислить`, `eval`), Keyword, nil},
			{`"`, LiteralString, Push("string")},
			{`[_а-яА-Я0-9][а-яА-Я0-9]*`, Name, nil},
			{`[_\w][\w]*`, Name, nil},
		},
		"string": {
			{`""`, LiteralString, nil},
			{`"C?`, LiteralString, Pop(1)},
			{`[^"]+`, LiteralString, nil},
		},
	}
}