mirror of
				https://github.com/alecthomas/chroma.git
				synced 2025-10-30 23:57:49 +02:00 
			
		
		
		
	refactor: migrate a bunch more Go-based lexers to XML
Also rename some existing XML lexers to their canonical XML name.
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -22,3 +22,4 @@ _models/ | ||||
|  | ||||
| _examples/ | ||||
| *.min.* | ||||
| build/ | ||||
|   | ||||
							
								
								
									
										4
									
								
								Bitfile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Bitfile
									
									
									
									
									
								
							| @@ -12,10 +12,10 @@ README.md: lexers/*.go lexers/*/*.xml table.py | ||||
| implicit %{1}%{2}.min.%{3}: **/*.{css,js} | ||||
|   build: esbuild --bundle %{IN} --minify --outfile=%{OUT} | ||||
|  | ||||
| implicit %{1}: cmd/* | ||||
| implicit build/%{1}: cmd/* | ||||
|   cd cmd/%{1} | ||||
|   inputs: cmd/%{1}/**/* **/*.go | ||||
|   build: go build -ldflags="-X 'main.version=%{VERSION}'" -o ../../%{1} . | ||||
|   build: go build -ldflags="-X 'main.version=%{VERSION}'" -o ../../build/%{1} . | ||||
|  | ||||
| #upload: chromad | ||||
| #  build: | ||||
|   | ||||
| @@ -1,202 +0,0 @@ | ||||
| import functools | ||||
| import importlib | ||||
| import json | ||||
| import os | ||||
| import re | ||||
| import sys | ||||
| import types | ||||
|  | ||||
| import pystache | ||||
| from pygments import lexer as pygments_lexer | ||||
| from pygments.token import _TokenType | ||||
|  | ||||
|  | ||||
| TEMPLATE = r''' | ||||
| package {{package}} | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| 	"github.com/alecthomas/chroma/v2/lexers/internal" | ||||
| ) | ||||
|  | ||||
| // {{upper_name}} lexer. | ||||
| var {{upper_name}} = internal.Register(MustNewLazyLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "{{name}}", | ||||
| 		{{=<% %>=}} | ||||
| 		Aliases:   []string{<%#aliases%>"<%.%>", <%/aliases%>}, | ||||
| 		Filenames: []string{<%#filenames%>"<%.%>", <%/filenames%>}, | ||||
| 		MimeTypes: []string{<%#mimetypes%>"<%.%>", <%/mimetypes%>}, | ||||
| 		<%={{ }}=%> | ||||
| {{#re_not_multiline}} | ||||
| 		NotMultiline: true, | ||||
| {{/re_not_multiline}} | ||||
| {{#re_dotall}} | ||||
| 		DotAll: true, | ||||
| {{/re_dotall}} | ||||
| {{#re_ignorecase}} | ||||
| 		CaseInsensitive: true, | ||||
| {{/re_ignorecase}} | ||||
| 	}, | ||||
| 	func() Rules { | ||||
| 		return Rules{ | ||||
| {{#tokens}} | ||||
| 			"{{state}}": { | ||||
| 				{{#rules}} | ||||
| 				{{{.}}}, | ||||
| 				{{/rules}} | ||||
| 			}, | ||||
| {{/tokens}} | ||||
| 		} | ||||
| 	}, | ||||
| )) | ||||
| ''' | ||||
|  | ||||
|  | ||||
| def go_regex(s): | ||||
|     return go_string(s) | ||||
|  | ||||
|  | ||||
| def go_string(s): | ||||
|     if '`' not in s: | ||||
|         return '`' + s + '`' | ||||
|     return json.dumps(s) | ||||
|  | ||||
|  | ||||
| def to_camel_case(snake_str): | ||||
|     components = snake_str.split('_') | ||||
|     return ''.join(x.title() for x in components) | ||||
|  | ||||
|  | ||||
| def warning(message): | ||||
|     print('warning: ' + message, file=sys.stderr) | ||||
|  | ||||
|  | ||||
| def resolve_emitter(emitter): | ||||
|     if isinstance(emitter, types.FunctionType): | ||||
|         if repr(emitter).startswith('<function bygroups.'): | ||||
|             args = emitter.__closure__[0].cell_contents | ||||
|             emitter = 'ByGroups(%s)' % ', '.join(resolve_emitter(e) for e in args) | ||||
|         elif repr(emitter).startswith('<function using.'): | ||||
|             args = emitter.__closure__[0].cell_contents | ||||
|             if isinstance(args, dict): | ||||
|                 state = 'root' | ||||
|                 if 'stack' in args: | ||||
|                     state = args['stack'][1] | ||||
|                     args.pop('stack') | ||||
|                 assert args == {}, args | ||||
|                 emitter = 'UsingSelf("%s")' % state | ||||
|             elif issubclass(args, pygments_lexer.Lexer): | ||||
|                 name = args.__name__ | ||||
|                 if name.endswith('Lexer'): | ||||
|                     name = name[:-5] | ||||
|                 emitter = 'Using(%s)' % name | ||||
|             else: | ||||
|                 raise ValueError('only support "using" with lexer classes, not %r' % args) | ||||
|         else: | ||||
|             warning('unsupported emitter function %r' % emitter) | ||||
|             emitter = '?? %r ??' % emitter | ||||
|     elif isinstance(emitter, _TokenType): | ||||
|         emitter = str(emitter).replace('.', '')[5:] | ||||
|     elif emitter is None: | ||||
|         # This generally only occurs when a lookahead/behind assertion is used, so we just allow it | ||||
|         # through. | ||||
|         return 'None' | ||||
|     else: | ||||
|         raise ValueError('unsupported emitter type %r' % emitter) | ||||
|     assert isinstance(emitter, str) | ||||
|     return emitter | ||||
|  | ||||
|  | ||||
| def process_state_action(action): | ||||
|     if isinstance(action, tuple): | ||||
|         return functools.reduce(lambda a, b: a + b, (process_state_action(a) for a in action)) | ||||
|     if action.startswith('#'): | ||||
|         action = action[1:] | ||||
|         if action== 'pop': | ||||
|             action = 'Pop(1)' | ||||
|         elif action.startswith('pop:'): | ||||
|             action = 'Pop(%s)' % action[4:] | ||||
|         elif action == 'push': | ||||
|             action = 'Push()' | ||||
|         elif action.startswith('push:'): | ||||
|             action = 'Push("%s")' % action[5:] | ||||
|         else: | ||||
|             raise ValueError('unsupported action %r' % (action,)) | ||||
|     else: | ||||
|         action = 'Push("%s")' % action | ||||
|     return (action,) | ||||
|  | ||||
|  | ||||
| def translate_rules(rules): | ||||
|     out = [] | ||||
|     for rule in rules: | ||||
|         if isinstance(rule, tuple): | ||||
|             regex = rule[0] | ||||
|             if isinstance(regex, str): | ||||
|                 regex = go_regex(regex) | ||||
|             elif isinstance(regex, pygments_lexer.words): | ||||
|                 regex = 'Words(%s, %s, %s)' % (go_string(regex.prefix), | ||||
|                                                go_string(regex.suffix), | ||||
|                                                ', '.join(go_string(w) for w in regex.words)) | ||||
|             else: | ||||
|                 raise ValueError('expected regex string but got %r' % regex) | ||||
|             emitter = resolve_emitter(rule[1]) | ||||
|             if len(rule) == 2: | ||||
|                 modifier = 'nil' | ||||
|             elif type(rule[2]) is str: | ||||
|                 modifier = process_state_action(rule[2])[0] | ||||
|             elif isinstance(rule[2], pygments_lexer.combined): | ||||
|                 modifier = 'Combined("%s")' % '", "'.join(rule[2]) | ||||
|             elif type(rule[2]) is tuple: | ||||
|                 modifier = 'Push("%s")' % '", "'.join(rule[2]) | ||||
|             else: | ||||
|                 raise ValueError('unsupported modifier %r' % (rule[2],)) | ||||
|             out.append('{{{}, {}, {}}}'.format(regex, emitter, modifier)) | ||||
|         elif isinstance(rule, pygments_lexer.include): | ||||
|             out.append('Include("{}")'.format(rule)) | ||||
|         elif isinstance(rule, pygments_lexer.default): | ||||
|             out.append('Default({})'.format(', '.join(process_state_action(rule.state)))) | ||||
|         else: | ||||
|             raise ValueError('unsupported rule %r' % (rule,)) | ||||
|     return out | ||||
|  | ||||
|  | ||||
| class TemplateView(object): | ||||
|     def __init__(self, **kwargs): | ||||
|         for key, value in kwargs.items(): | ||||
|             setattr(self, key, value) | ||||
|  | ||||
|     def re_not_multiline(self): | ||||
|         return not (self.regex_flags & re.MULTILINE) | ||||
|  | ||||
|     def re_dotall(self): | ||||
|         return self.regex_flags & re.DOTALL | ||||
|  | ||||
|     def re_ignorecase(self): | ||||
|         return self.regex_flags & re.IGNORECASE | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     package_name, symbol_name = sys.argv[1].rsplit(sep=".", maxsplit=1) | ||||
|  | ||||
|     package = importlib.import_module(package_name) | ||||
|  | ||||
|     lexer_cls = getattr(package, symbol_name) | ||||
|  | ||||
|     assert issubclass(lexer_cls, pygments_lexer.RegexLexer), 'can only translate from RegexLexer' | ||||
|  | ||||
|     print(pystache.render(TEMPLATE, TemplateView( | ||||
|         package=lexer_cls.name.lower()[0], | ||||
|         name=lexer_cls.name, | ||||
|         regex_flags=lexer_cls.flags, | ||||
|         upper_name=to_camel_case(re.sub(r'\W', '_', lexer_cls.name)), | ||||
|         aliases=lexer_cls.aliases, | ||||
|         filenames=lexer_cls.filenames, | ||||
|         mimetypes=lexer_cls.mimetypes, | ||||
|         tokens=[{'state': state, 'rules': translate_rules(rules)} for (state, rules) in lexer_cls.get_tokendefs().items()], | ||||
|     ))) | ||||
|  | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     main() | ||||
							
								
								
									
										1
									
								
								bin/.watchexec-1.23.0.pkg
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								bin/.watchexec-1.23.0.pkg
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| hermit | ||||
							
								
								
									
										1
									
								
								bin/watchexec
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								bin/watchexec
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| .watchexec-1.23.0.pkg | ||||
| @@ -413,9 +413,10 @@ func dumpXMLLexerDefinitions(dir string) error { | ||||
| 			// fmt.Println(name) | ||||
| 			_, err = os.Stat(filename) | ||||
| 			if err == nil { | ||||
| 				return fmt.Errorf("%s already exists", filename) | ||||
| 				fmt.Fprintf(os.Stderr, "warning: %s already exists\n", filename) | ||||
| 				continue | ||||
| 			} | ||||
| 			err = ioutil.WriteFile(filename, data, 0600) | ||||
| 			err = os.WriteFile(filename, data, 0600) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
|   | ||||
							
								
								
									
										4
									
								
								lexer.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								lexer.go
									
									
									
									
									
								
							| @@ -69,8 +69,8 @@ type Config struct { | ||||
| // AnalyseConfig defines the list of regexes analysers. | ||||
| type AnalyseConfig struct { | ||||
| 	Regexes []RegexConfig `xml:"regex,omitempty"` | ||||
| 	// If true, the score is returned despite other matches. | ||||
| 	Single bool `xml:"single,attr"` | ||||
| 	// If true, the first matching score is returned. | ||||
| 	First bool `xml:"first,attr"` | ||||
| } | ||||
|  | ||||
| // RegexConfig defines a single regex pattern and its score in case of match. | ||||
|   | ||||
| @@ -1,17 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	"regexp" | ||||
| ) | ||||
|  | ||||
| // TODO(moorereason): can this be factored away? | ||||
| var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`) | ||||
|  | ||||
| func init() { // nolint: gochecknoinits | ||||
| 	Get("bash").SetAnalyser(func(text string) float32 { | ||||
| 		if bashAnalyserRe.FindString(text) != "" { | ||||
| 			return 1.0 | ||||
| 		} | ||||
| 		return 0.0 | ||||
| 	}) | ||||
| } | ||||
| @@ -1,62 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Chapel lexer. | ||||
| var Chapel = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Chapel", | ||||
| 		Aliases:   []string{"chapel", "chpl"}, | ||||
| 		Filenames: []string{"*.chpl"}, | ||||
| 		MimeTypes: []string{}, | ||||
| 	}, | ||||
| 	func() Rules { | ||||
| 		return Rules{ | ||||
| 			"root": { | ||||
| 				{`\n`, TextWhitespace, nil}, | ||||
| 				{`\s+`, TextWhitespace, nil}, | ||||
| 				{`\\\n`, Text, nil}, | ||||
| 				{`//(.*?)\n`, CommentSingle, nil}, | ||||
| 				{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil}, | ||||
| 				{Words(``, `\b`, `config`, `const`, `in`, `inout`, `out`, `param`, `ref`, `type`, `var`), KeywordDeclaration, nil}, | ||||
| 				{Words(``, `\b`, `false`, `nil`, `none`, `true`), KeywordConstant, nil}, | ||||
| 				{Words(``, `\b`, `bool`, `bytes`, `complex`, `imag`, `int`, `locale`, `nothing`, `opaque`, `range`, `real`, `string`, `uint`, `void`), KeywordType, nil}, | ||||
| 				{Words(``, `\b`, `atomic`, `single`, `sync`, `borrowed`, `owned`, `shared`, `unmanaged`, `align`, `as`, `begin`, `break`, `by`, `catch`, `cobegin`, `coforall`, `continue`, `defer`, `delete`, `dmapped`, `do`, `domain`, `else`, `enum`, `except`, `export`, `extern`, `for`, `forall`, `foreach`, `forwarding`, `if`, `implements`, `import`, `index`, `init`, `inline`, `label`, `lambda`, `let`, `lifetime`, `local`, `new`, `noinit`, `on`, `only`, `otherwise`, `override`, `pragma`, `primitive`, `private`, `prototype`, `public`, `reduce`, `require`, `return`, `scan`, `select`, `serial`, `sparse`, `subdomain`, `then`, `this`, `throw`, `throws`, `try`, `use`, `when`, `where`, `while`, `with`, `yield`, `zip`), Keyword, nil}, | ||||
| 				{`(iter)(\s+)`, ByGroups(Keyword, TextWhitespace), Push("procname")}, | ||||
| 				{`(proc)(\s+)`, ByGroups(Keyword, TextWhitespace), Push("procname")}, | ||||
| 				{`(operator)(\s+)`, ByGroups(Keyword, TextWhitespace), Push("procname")}, | ||||
| 				{`(class|interface|module|record|union)(\s+)`, ByGroups(Keyword, TextWhitespace), Push("classname")}, | ||||
| 				{`\d+i`, LiteralNumber, nil}, | ||||
| 				{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, | ||||
| 				{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil}, | ||||
| 				{`\d+[Ee][-+]\d+i`, LiteralNumber, nil}, | ||||
| 				{`(\d*\.\d+)([eE][+-]?[0-9]+)?i?`, LiteralNumberFloat, nil}, | ||||
| 				{`\d+[eE][+-]?[0-9]+i?`, LiteralNumberFloat, nil}, | ||||
| 				{`0[bB][01]+`, LiteralNumberBin, nil}, | ||||
| 				{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil}, | ||||
| 				{`0[oO][0-7]+`, LiteralNumberOct, nil}, | ||||
| 				{`[0-9]+`, LiteralNumberInteger, nil}, | ||||
| 				{`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, | ||||
| 				{`'(\\\\|\\'|[^'])*'`, LiteralString, nil}, | ||||
| 				{`(=|\+=|-=|\*=|/=|\*\*=|%=|&=|\|=|\^=|&&=|\|\|=|<<=|>>=|<=>|<~>|\.\.|by|#|\.\.\.|&&|\|\||!|&|\||\^|~|<<|>>|==|!=|<=|>=|<|>|[+\-*/%]|\*\*)`, Operator, nil}, | ||||
| 				{`[:;,.?()\[\]{}]`, Punctuation, nil}, | ||||
| 				{`[a-zA-Z_][\w$]*`, NameOther, nil}, | ||||
| 			}, | ||||
| 			"classname": { | ||||
| 				{`[a-zA-Z_][\w$]*`, NameClass, Pop(1)}, | ||||
| 			}, | ||||
| 			"procname": { | ||||
| 				{`([a-zA-Z_][.\w$]*|\~[a-zA-Z_][.\w$]*|[+*/!~%<>=&^|\-:]{1,2})`, NameFunction, Pop(1)}, | ||||
| 				{`\(`, Punctuation, Push("receivertype")}, | ||||
| 				{`\)+\.`, Punctuation, nil}, | ||||
| 			}, | ||||
| 			"receivertype": { | ||||
| 				{Words(``, `\b`, `atomic`, `single`, `sync`, `borrowed`, `owned`, `shared`, `unmanaged`), Keyword, nil}, | ||||
| 				{Words(``, `\b`, `bool`, `bytes`, `complex`, `imag`, `int`, `locale`, `nothing`, `opaque`, `range`, `real`, `string`, `uint`, `void`), KeywordType, nil}, | ||||
| 				{`[^()]*`, NameOther, Pop(1)}, | ||||
| 			}, | ||||
| 		} | ||||
| 	}, | ||||
| )) | ||||
| @@ -1,39 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Cheetah lexer. | ||||
| var Cheetah = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Cheetah", | ||||
| 		Aliases:   []string{"cheetah", "spitfire"}, | ||||
| 		Filenames: []string{"*.tmpl", "*.spt"}, | ||||
| 		MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"}, | ||||
| 	}, | ||||
| 	cheetahRules, | ||||
| )) | ||||
|  | ||||
| func cheetahRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`(##[^\n]*)$`, ByGroups(Comment), nil}, | ||||
| 			{`#[*](.|\n)*?[*]#`, Comment, nil}, | ||||
| 			{`#end[^#\n]*(?:#|$)`, CommentPreproc, nil}, | ||||
| 			{`#slurp$`, CommentPreproc, nil}, | ||||
| 			{`(#[a-zA-Z]+)([^#\n]*)(#|$)`, ByGroups(CommentPreproc, Using("Python"), CommentPreproc), nil}, | ||||
| 			{`(\$)([a-zA-Z_][\w.]*\w)`, ByGroups(CommentPreproc, Using("Python")), nil}, | ||||
| 			{`(\$\{!?)(.*?)(\})(?s)`, ByGroups(CommentPreproc, Using("Python"), CommentPreproc), nil}, | ||||
| 			{`(?sx) | ||||
|                 (.+?)               # anything, followed by: | ||||
|                 (?: | ||||
|                  (?=\#[#a-zA-Z]*) | # an eval comment | ||||
|                  (?=\$[a-zA-Z_{]) | # a substitution | ||||
|                  \Z                 # end of string | ||||
|                 ) | ||||
|             `, Other, nil}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,70 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // CassandraCQL lexer. | ||||
| var CassandraCQL = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:            "Cassandra CQL", | ||||
| 		Aliases:         []string{"cassandra", "cql"}, | ||||
| 		Filenames:       []string{"*.cql"}, | ||||
| 		MimeTypes:       []string{"text/x-cql"}, | ||||
| 		NotMultiline:    true, | ||||
| 		CaseInsensitive: true, | ||||
| 	}, | ||||
| 	cassandraCQLRules, | ||||
| )) | ||||
|  | ||||
| func cassandraCQLRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`\s+`, TextWhitespace, nil}, | ||||
| 			{`(--|\/\/).*\n?`, CommentSingle, nil}, | ||||
| 			{`/\*`, CommentMultiline, Push("multiline-comments")}, | ||||
| 			{`(ascii|bigint|blob|boolean|counter|date|decimal|double|float|frozen|inet|int|list|map|set|smallint|text|time|timestamp|timeuuid|tinyint|tuple|uuid|varchar|varint)\b`, NameBuiltin, nil}, | ||||
| 			{Words(``, `\b`, `ADD`, `AGGREGATE`, `ALL`, `ALLOW`, `ALTER`, `AND`, `ANY`, `APPLY`, `AS`, `ASC`, `AUTHORIZE`, `BATCH`, `BEGIN`, `BY`, `CLUSTERING`, `COLUMNFAMILY`, `COMPACT`, `CONSISTENCY`, `COUNT`, `CREATE`, `CUSTOM`, `DELETE`, `DESC`, `DISTINCT`, `DROP`, `EACH_QUORUM`, `ENTRIES`, `EXISTS`, `FILTERING`, `FROM`, `FULL`, `GRANT`, `IF`, `IN`, `INDEX`, `INFINITY`, `INSERT`, `INTO`, `KEY`, `KEYS`, `KEYSPACE`, `KEYSPACES`, `LEVEL`, `LIMIT`, `LOCAL_ONE`, `LOCAL_QUORUM`, `MATERIALIZED`, `MODIFY`, `NAN`, `NORECURSIVE`, `NOSUPERUSER`, `NOT`, `OF`, `ON`, `ONE`, `ORDER`, `PARTITION`, `PASSWORD`, `PER`, `PERMISSION`, `PERMISSIONS`, `PRIMARY`, `QUORUM`, `RENAME`, `REVOKE`, `SCHEMA`, `SELECT`, `STATIC`, `STORAGE`, `SUPERUSER`, `TABLE`, `THREE`, `TO`, `TOKEN`, `TRUNCATE`, `TTL`, `TWO`, `TYPE`, `UNLOGGED`, `UPDATE`, `USE`, `USER`, `USERS`, `USING`, `VALUES`, `VIEW`, `WHERE`, `WITH`, `WRITETIME`, `REPLICATION`, `OR`, `REPLACE`, `FUNCTION`, `CALLED`, `INPUT`, `RETURNS`, `LANGUAGE`, `ROLE`, `ROLES`, `TRIGGER`, `DURABLE_WRITES`, `LOGIN`, `OPTIONS`, `LOGGED`, `SFUNC`, `STYPE`, `FINALFUNC`, `INITCOND`, `IS`, `CONTAINS`, `JSON`, `PAGING`, `OFF`), Keyword, nil}, | ||||
| 			{"[+*/<>=~!@#%^&|`?-]+", Operator, nil}, | ||||
| 			{ | ||||
| 				`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`, | ||||
| 				UsingByGroup(1, 6, | ||||
| 					NameBuiltin, TextWhitespace, Keyword, TextWhitespace, | ||||
| 					LiteralStringHeredoc, LiteralStringHeredoc, LiteralStringHeredoc), | ||||
| 				nil, | ||||
| 			}, | ||||
| 			{`(true|false|null)\b`, KeywordConstant, nil}, | ||||
| 			{`0x[0-9a-f]+`, LiteralNumberHex, nil}, | ||||
| 			{`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, LiteralNumberHex, nil}, | ||||
| 			{`\.[0-9]+(e[+-]?[0-9]+)?`, Error, nil}, | ||||
| 			{`-?[0-9]+(\.[0-9])?(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, | ||||
| 			{`[0-9]+`, LiteralNumberInteger, nil}, | ||||
| 			{`'`, LiteralStringSingle, Push("string")}, | ||||
| 			{`"`, LiteralStringName, Push("quoted-ident")}, | ||||
| 			{`\$\$`, LiteralStringHeredoc, Push("dollar-string")}, | ||||
| 			{`[a-z_]\w*`, Name, nil}, | ||||
| 			{`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil}, | ||||
| 			{`[;:()\[\]\{\},.]`, Punctuation, nil}, | ||||
| 		}, | ||||
| 		"multiline-comments": { | ||||
| 			{`/\*`, CommentMultiline, Push("multiline-comments")}, | ||||
| 			{`\*/`, CommentMultiline, Pop(1)}, | ||||
| 			{`[^/*]+`, CommentMultiline, nil}, | ||||
| 			{`[/*]`, CommentMultiline, nil}, | ||||
| 		}, | ||||
| 		"string": { | ||||
| 			{`[^']+`, LiteralStringSingle, nil}, | ||||
| 			{`''`, LiteralStringSingle, nil}, | ||||
| 			{`'`, LiteralStringSingle, Pop(1)}, | ||||
| 		}, | ||||
| 		"quoted-ident": { | ||||
| 			{`[^"]+`, LiteralStringName, nil}, | ||||
| 			{`""`, LiteralStringName, nil}, | ||||
| 			{`"`, LiteralStringName, Pop(1)}, | ||||
| 		}, | ||||
| 		"dollar-string": { | ||||
| 			{`[^\$]+`, LiteralStringHeredoc, nil}, | ||||
| 			{`\$\$`, LiteralStringHeredoc, Pop(1)}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,32 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Docker lexer. | ||||
| var Docker = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:            "Docker", | ||||
| 		Aliases:         []string{"docker", "dockerfile"}, | ||||
| 		Filenames:       []string{"Dockerfile", "Dockerfile.*", "*.docker"}, | ||||
| 		MimeTypes:       []string{"text/x-dockerfile-config"}, | ||||
| 		CaseInsensitive: true, | ||||
| 	}, | ||||
| 	dockerRules, | ||||
| )) | ||||
|  | ||||
| func dockerRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`#.*`, Comment, nil}, | ||||
| 			{`(ONBUILD)((?:\s*\\?\s*))`, ByGroups(Keyword, Using("Bash")), nil}, | ||||
| 			{`(HEALTHCHECK)(((?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using("Bash")), nil}, | ||||
| 			{`(VOLUME|ENTRYPOINT|CMD|SHELL)((?:\s*\\?\s*))(\[.*?\])`, ByGroups(Keyword, Using("Bash"), Using("JSON")), nil}, | ||||
| 			{`(LABEL|ENV|ARG)((?:(?:\s*\\?\s*)\w+=\w+(?:\s*\\?\s*))*)`, ByGroups(Keyword, Using("Bash")), nil}, | ||||
| 			{`((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(.*)`, ByGroups(Keyword, LiteralString), nil}, | ||||
| 			{`((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))`, Keyword, nil}, | ||||
| 			{`(.*\\\n)*.+`, Using("Bash"), nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -4,9 +4,9 @@ | ||||
|     <alias>aql</alias> | ||||
|     <filename>*.aql</filename> | ||||
|     <mime_type>text/x-aql</mime_type> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|     <dot_all>true</dot_all> | ||||
|     <ensure_nl>true</ensure_nl> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="comments-and-whitespace"> | ||||
| @@ -37,10 +37,10 @@ | ||||
|       <rule pattern="\\."> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^"\\]+"> | ||||
|       <rule pattern="[^"\\]+"> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
| @@ -49,10 +49,10 @@ | ||||
|       <rule pattern="\\."> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^'\\]+"> | ||||
|       <rule pattern="[^'\\]+"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
| @@ -155,15 +155,14 @@ | ||||
|       <rule pattern="(?:to_bool|to_number|to_string|to_array|to_list|is_null|is_bool|is_number|is_string|is_array|is_list|is_object|is_document|is_datestring|typename|json_stringify|json_parse|concat|concat_separator|char_length|lower|upper|substring|substring_bytes|left|right|trim|reverse|contains|log|log2|log10|exp|exp2|sin|cos|tan|asin|acos|atan|atan2|radians|degrees|pi|regex_test|regex_replace|like|floor|ceil|round|abs|rand|sqrt|pow|length|count|min|max|average|avg|sum|product|median|variance_population|variance_sample|variance|percentile|bit_and|bit_or|bit_xor|bit_negate|bit_test|bit_popcount|bit_shift_left|bit_shift_right|bit_construct|bit_deconstruct|bit_to_string|bit_from_string|first|last|unique|outersection|interleave|in_range|jaccard|matches|merge|merge_recursive|has|attributes|keys|values|unset|unset_recursive|keep|keep_recursive|near|within|within_rectangle|is_in_polygon|distance|fulltext|stddev_sample|stddev_population|stddev|slice|nth|position|contains_array|translate|zip|call|apply|push|append|pop|shift|unshift|remove_value|remove_values|remove_nth|replace_nth|date_now|date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|date_minute|date_second|date_millisecond|date_dayofyear|date_isoweek|date_isoweekyear|date_leapyear|date_quarter|date_days_in_month|date_trunc|date_round|date_add|date_subtract|date_diff|date_compare|date_format|date_utctolocal|date_localtoutc|date_timezone|date_timezones|fail|passthru|v8|sleep|schema_get|schema_validate|shard_id|version|noopt|noeval|not_null|first_list|first_document|parse_identifier|current_user|current_database|collection_count|pregel_result|collections|document|decode_rev|range|union|union_distinct|minus|intersection|flatten|is_same_collection|check_document|ltrim|rtrim|find_first|find_last|split|substitute|ipv4_to_number|ipv4_from_number|is_ipv4|md5|sha1|sha256|sha512|crc32|fnv64|hash|random_token|to_base64|to_hex|encode_uri_component|soundex|assert|warn|is_key|sorted|sorted_unique|count_distinct|count_unique|levenshtein_distance|levenshtein_match|regex_matches|regex_split|ngram_match|ngram_similarity|ngram_positional_similarity|uuid|tokens|exists|starts_with|phrase|min_match|bm25|tfidf|boost|analyzer|offset_info|value|cosine_similarity|decay_exp|decay_gauss|decay_linear|l1_distance|l2_distance|minhash|minhash_count|minhash_error|minhash_match|geo_point|geo_multipoint|geo_polygon|geo_multipolygon|geo_linestring|geo_multilinestring|geo_contains|geo_intersects|geo_equals|geo_distance|geo_area|geo_in_range)(?=\s*\()"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|         <push state="double-quote"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <push state="single-quote"/> | ||||
|       </rule> | ||||
|       <!-- not part of the language but useful for highlighting query explain outputs --> | ||||
|       <rule pattern="#\d+\b"> | ||||
|         <token type="NameLabel"/> | ||||
|       </rule> | ||||
| @@ -172,4 +171,4 @@ | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
| </lexer> | ||||
| @@ -26,6 +26,9 @@ | ||||
|     <filename>PKGBUILD</filename> | ||||
|     <mime_type>application/x-sh</mime_type> | ||||
|     <mime_type>application/x-shellscript</mime_type> | ||||
|     <analyse first="true" > | ||||
|       <regex pattern="(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)" score="1.0" /> | ||||
|     </analyse> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="data"> | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)"> | ||||
|       <rule pattern="^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)"> | ||||
|         <bygroups> | ||||
|           <token type="GenericPrompt"/> | ||||
|           <token type="Text"/> | ||||
| @@ -19,7 +19,7 @@ | ||||
|     <mime_type>text/x-c++hdr</mime_type> | ||||
|     <mime_type>text/x-c++src</mime_type> | ||||
|     <ensure_nl>true</ensure_nl> | ||||
|     <analyse single="true"> | ||||
|     <analyse first="true"> | ||||
|       <regex pattern="#include <[a-z_]+>" score="0.2" /> | ||||
|       <regex pattern="using namespace " score="0.4" /> | ||||
|     </analyse> | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
|     <mime_type>image/x-xbitmap</mime_type> | ||||
|     <mime_type>image/x-xpixmap</mime_type> | ||||
|     <ensure_nl>true</ensure_nl> | ||||
|     <analyse single="true" > | ||||
|     <analyse first="true" > | ||||
|       <regex pattern="(?m)^\s*#include <" score="0.1" /> | ||||
|       <regex pattern="(?m)^\s*#ifn?def " score="0.1" /> | ||||
|     </analyse> | ||||
|   | ||||
							
								
								
									
										137
									
								
								lexers/embedded/cassandra_cql.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								lexers/embedded/cassandra_cql.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,137 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Cassandra CQL</name> | ||||
|     <alias>cassandra</alias> | ||||
|     <alias>cql</alias> | ||||
|     <filename>*.cql</filename> | ||||
|     <mime_type>text/x-cql</mime_type> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|     <not_multiline>true</not_multiline> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="string"> | ||||
|       <rule pattern="[^']+"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="''"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="quoted-ident"> | ||||
|       <rule pattern="[^"]+"> | ||||
|         <token type="LiteralStringName"/> | ||||
|       </rule> | ||||
|       <rule pattern=""""> | ||||
|         <token type="LiteralStringName"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringName"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="dollar-string"> | ||||
|       <rule pattern="[^\$]+"> | ||||
|         <token type="LiteralStringHeredoc"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$\$"> | ||||
|         <token type="LiteralStringHeredoc"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="TextWhitespace"/> | ||||
|       </rule> | ||||
|       <rule pattern="(--|\/\/).*\n?"> | ||||
|         <token type="CommentSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="/\*"> | ||||
|         <token type="CommentMultiline"/> | ||||
|         <push state="multiline-comments"/> | ||||
|       </rule> | ||||
|       <rule pattern="(ascii|bigint|blob|boolean|counter|date|decimal|double|float|frozen|inet|int|list|map|set|smallint|text|time|timestamp|timeuuid|tinyint|tuple|uuid|varchar|varint)\b"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(DURABLE_WRITES|LOCAL_QUORUM|MATERIALIZED|COLUMNFAMILY|REPLICATION|NORECURSIVE|NOSUPERUSER|PERMISSIONS|EACH_QUORUM|CONSISTENCY|PERMISSION|CLUSTERING|WRITETIME|SUPERUSER|KEYSPACES|AUTHORIZE|LOCAL_ONE|AGGREGATE|FINALFUNC|PARTITION|FILTERING|UNLOGGED|CONTAINS|DISTINCT|FUNCTION|LANGUAGE|INFINITY|INITCOND|TRUNCATE|KEYSPACE|PASSWORD|REPLACE|OPTIONS|TRIGGER|STORAGE|ENTRIES|RETURNS|COMPACT|PRIMARY|EXISTS|STATIC|PAGING|UPDATE|CUSTOM|VALUES|INSERT|DELETE|MODIFY|CREATE|SELECT|SCHEMA|LOGGED|REVOKE|RENAME|QUORUM|CALLED|STYPE|ORDER|ALTER|BATCH|BEGIN|COUNT|ROLES|APPLY|WHERE|SFUNC|LEVEL|INPUT|LOGIN|INDEX|TABLE|THREE|ALLOW|TOKEN|LIMIT|USING|USERS|GRANT|FROM|KEYS|JSON|USER|INTO|ROLE|TYPE|VIEW|DESC|WITH|DROP|FULL|ASC|TTL|OFF|PER|KEY|USE|ADD|NAN|ONE|ALL|ANY|TWO|AND|NOT|AS|IN|IF|OF|IS|ON|TO|BY|OR)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="[+*/<>=~!@#%^&|`?-]+"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)"> | ||||
|         <usingbygroup> | ||||
|           <sublexer_name_group>1</sublexer_name_group> | ||||
|           <code_group>6</code_group> | ||||
|           <emitters> | ||||
|             <token type="NameBuiltin"/> | ||||
|             <token type="TextWhitespace"/> | ||||
|             <token type="Keyword"/> | ||||
|             <token type="TextWhitespace"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|           </emitters> | ||||
|         </usingbygroup> | ||||
|       </rule> | ||||
|       <rule pattern="(true|false|null)\b"> | ||||
|         <token type="KeywordConstant"/> | ||||
|       </rule> | ||||
|       <rule pattern="0x[0-9a-f]+"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="\.[0-9]+(e[+-]?[0-9]+)?"> | ||||
|         <token type="Error"/> | ||||
|       </rule> | ||||
|       <rule pattern="-?[0-9]+(\.[0-9])?(e[+-]?[0-9]+)?"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9]+"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <push state="string"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringName"/> | ||||
|         <push state="quoted-ident"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$\$"> | ||||
|         <token type="LiteralStringHeredoc"/> | ||||
|         <push state="dollar-string"/> | ||||
|       </rule> | ||||
|       <rule pattern="[a-z_]\w*"> | ||||
|         <token type="Name"/> | ||||
|       </rule> | ||||
|       <rule pattern=":(['"]?)[a-z]\w*\b\1"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="[;:()\[\]\{\},.]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="multiline-comments"> | ||||
|       <rule pattern="/\*"> | ||||
|         <token type="CommentMultiline"/> | ||||
|         <push state="multiline-comments"/> | ||||
|       </rule> | ||||
|       <rule pattern="\*/"> | ||||
|         <token type="CommentMultiline"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^/*]+"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|       <rule pattern="[/*]"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										143
									
								
								lexers/embedded/chapel.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								lexers/embedded/chapel.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,143 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Chapel</name> | ||||
|     <alias>chapel</alias> | ||||
|     <alias>chpl</alias> | ||||
|     <filename>*.chpl</filename> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="procname"> | ||||
|       <rule pattern="([a-zA-Z_][.\w$]*|\~[a-zA-Z_][.\w$]*|[+*/!~%<>=&^|\-:]{1,2})"> | ||||
|         <token type="NameFunction"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="\("> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="receivertype"/> | ||||
|       </rule> | ||||
|       <rule pattern="\)+\."> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="receivertype"> | ||||
|       <rule pattern="(unmanaged|borrowed|atomic|single|shared|owned|sync)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="(complex|nothing|opaque|string|locale|bytes|range|imag|real|bool|uint|void|int)\b"> | ||||
|         <token type="KeywordType"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^()]*"> | ||||
|         <token type="NameOther"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="TextWhitespace"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="TextWhitespace"/> | ||||
|       </rule> | ||||
|       <rule pattern="\\\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="//(.*?)\n"> | ||||
|         <token type="CommentSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="/(\\\n)?[*](.|\n)*?[*](\\\n)?/"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|       <rule pattern="(config|const|inout|param|type|out|ref|var|in)\b"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="(false|none|true|nil)\b"> | ||||
|         <token type="KeywordConstant"/> | ||||
|       </rule> | ||||
|       <rule pattern="(complex|nothing|opaque|string|locale|bytes|range|imag|real|bool|uint|void|int)\b"> | ||||
|         <token type="KeywordType"/> | ||||
|       </rule> | ||||
|       <rule pattern="(implements|forwarding|prototype|otherwise|subdomain|primitive|unmanaged|override|borrowed|lifetime|coforall|continue|private|require|dmapped|cobegin|foreach|lambda|sparse|shared|domain|pragma|reduce|except|export|extern|throws|forall|delete|return|noinit|single|import|select|public|inline|serial|atomic|defer|break|local|index|throw|catch|label|begin|where|while|align|yield|owned|only|this|sync|with|scan|else|enum|init|when|then|let|for|try|use|new|zip|if|by|as|on|do)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="(iter)(\s+)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="procname"/> | ||||
|       </rule> | ||||
|       <rule pattern="(proc)(\s+)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="procname"/> | ||||
|       </rule> | ||||
|       <rule pattern="(operator)(\s+)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="procname"/> | ||||
|       </rule> | ||||
|       <rule pattern="(class|interface|module|record|union)(\s+)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="classname"/> | ||||
|       </rule> | ||||
|       <rule pattern="\d+i"> | ||||
|         <token type="LiteralNumber"/> | ||||
|       </rule> | ||||
|       <rule pattern="\d+\.\d*([Ee][-+]\d+)?i"> | ||||
|         <token type="LiteralNumber"/> | ||||
|       </rule> | ||||
|       <rule pattern="\.\d+([Ee][-+]\d+)?i"> | ||||
|         <token type="LiteralNumber"/> | ||||
|       </rule> | ||||
|       <rule pattern="\d+[Ee][-+]\d+i"> | ||||
|         <token type="LiteralNumber"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\d*\.\d+)([eE][+-]?[0-9]+)?i?"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="\d+[eE][+-]?[0-9]+i?"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="0[bB][01]+"> | ||||
|         <token type="LiteralNumberBin"/> | ||||
|       </rule> | ||||
|       <rule pattern="0[xX][0-9a-fA-F]+"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="0[oO][0-7]+"> | ||||
|         <token type="LiteralNumberOct"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9]+"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern=""(\\\\|\\"|[^"])*""> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="'(\\\\|\\'|[^'])*'"> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="(=|\+=|-=|\*=|/=|\*\*=|%=|&=|\|=|\^=|&&=|\|\|=|<<=|>>=|<=>|<~>|\.\.|by|#|\.\.\.|&&|\|\||!|&|\||\^|~|<<|>>|==|!=|<=|>=|<|>|[+\-*/%]|\*\*)"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="[:;,.?()\[\]{}]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="[a-zA-Z_][\w$]*"> | ||||
|         <token type="NameOther"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="classname"> | ||||
|       <rule pattern="[a-zA-Z_][\w$]*"> | ||||
|         <token type="NameClass"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										55
									
								
								lexers/embedded/cheetah.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								lexers/embedded/cheetah.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Cheetah</name> | ||||
|     <alias>cheetah</alias> | ||||
|     <alias>spitfire</alias> | ||||
|     <filename>*.tmpl</filename> | ||||
|     <filename>*.spt</filename> | ||||
|     <mime_type>application/x-cheetah</mime_type> | ||||
|     <mime_type>application/x-spitfire</mime_type> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="(##[^\n]*)$"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="#[*](.|\n)*?[*]#"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="#end[^#\n]*(?:#|$)"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="#slurp$"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(#[a-zA-Z]+)([^#\n]*)(#|$)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="Python"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\$)([a-zA-Z_][\w.]*\w)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="Python"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\$\{!?)(.*?)(\})(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="Python"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?sx)
                (.+?)               # anything, followed by:
                (?:
                 (?=\#[#a-zA-Z]*) | # an eval comment
                 (?=\$[a-zA-Z_{]) | # a substitution
                 \Z                 # end of string
                )
            "> | ||||
|         <token type="Other"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										56
									
								
								lexers/embedded/docker.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								lexers/embedded/docker.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Docker</name> | ||||
|     <alias>docker</alias> | ||||
|     <alias>dockerfile</alias> | ||||
|     <filename>Dockerfile</filename> | ||||
|     <filename>Dockerfile.*</filename> | ||||
|     <filename>*.docker</filename> | ||||
|     <mime_type>text/x-dockerfile-config</mime_type> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="#.*"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="(ONBUILD)((?:\s*\\?\s*))"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <using lexer="Bash"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(HEALTHCHECK)(((?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <using lexer="Bash"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(VOLUME|ENTRYPOINT|CMD|SHELL)((?:\s*\\?\s*))(\[.*?\])"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <using lexer="Bash"/> | ||||
|           <using lexer="JSON"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(LABEL|ENV|ARG)((?:(?:\s*\\?\s*)\w+=\w+(?:\s*\\?\s*))*)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <using lexer="Bash"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(.*)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="(.*\\\n)*.+"> | ||||
|         <using lexer="Bash"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										71
									
								
								lexers/embedded/fortranfixed.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								lexers/embedded/fortranfixed.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>FortranFixed</name> | ||||
|     <alias>fortranfixed</alias> | ||||
|     <filename>*.f</filename> | ||||
|     <filename>*.F</filename> | ||||
|     <mime_type>text/x-fortran</mime_type> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|     <not_multiline>true</not_multiline> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="cont-char"> | ||||
|       <rule pattern=" "> | ||||
|         <token type="TextWhitespace"/> | ||||
|         <push state="code"/> | ||||
|       </rule> | ||||
|       <rule pattern="."> | ||||
|         <token type="GenericStrong"/> | ||||
|         <push state="code"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="code"> | ||||
|       <rule pattern="(.{66})(.*)(\n)"> | ||||
|         <bygroups> | ||||
|           <using lexer="Fortran"/> | ||||
|           <token type="Comment"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="root"/> | ||||
|       </rule> | ||||
|       <rule pattern="(.*)(!.*)(\n)"> | ||||
|         <bygroups> | ||||
|           <using lexer="Fortran"/> | ||||
|           <token type="Comment"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="root"/> | ||||
|       </rule> | ||||
|       <rule pattern="(.*)(\n)"> | ||||
|         <bygroups> | ||||
|           <using lexer="Fortran"/> | ||||
|           <token type="TextWhitespace"/> | ||||
|         </bygroups> | ||||
|         <push state="root"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <mutators> | ||||
|           <push state="root"/> | ||||
|         </mutators> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern="[C*].*\n"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="#.*\n"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern=" {0,4}!.*\n"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="(.{5})"> | ||||
|         <token type="NameLabel"/> | ||||
|         <push state="cont-char"/> | ||||
|       </rule> | ||||
|       <rule pattern=".*\n"> | ||||
|         <using lexer="Fortran"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <mime_type>text/x-gdscript</mime_type> | ||||
|     <mime_type>application/x-gdscript</mime_type> | ||||
|     <priority>0.1</priority> | ||||
|     <analyse single="true"> | ||||
|     <analyse first="true"> | ||||
|       <regex pattern="^@" score="0.4"/> | ||||
|     </analyse> | ||||
|   </config> | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|     <filename>*.gd</filename> | ||||
|     <mime_type>text/x-gdscript</mime_type> | ||||
|     <mime_type>application/x-gdscript</mime_type> | ||||
|     <analyse single="true"> | ||||
|     <analyse first="true"> | ||||
|       <regex pattern="^export" score="0.1"/> | ||||
|     </analyse> | ||||
|   </config> | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Go HTML Template</name> | ||||
|     <alias>go-html-template</alias> | ||||
|     <name>Go Template</name> | ||||
|     <alias>go-template</alias> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="template"> | ||||
|   | ||||
							
								
								
									
										159
									
								
								lexers/embedded/html.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										159
									
								
								lexers/embedded/html.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,159 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>HTML</name> | ||||
|     <alias>html</alias> | ||||
|     <filename>*.html</filename> | ||||
|     <filename>*.htm</filename> | ||||
|     <filename>*.xhtml</filename> | ||||
|     <filename>*.xslt</filename> | ||||
|     <mime_type>text/html</mime_type> | ||||
|     <mime_type>application/xhtml+xml</mime_type> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|     <dot_all>true</dot_all> | ||||
|     <not_multiline>true</not_multiline> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="script-content"> | ||||
|       <rule pattern="(<)(\s*)(/)(\s*)(script)(\s*)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern=".+?(?=<\s*/\s*script\s*>)"> | ||||
|         <using lexer="Javascript"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="style-content"> | ||||
|       <rule pattern="(<)(\s*)(/)(\s*)(style)(\s*)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern=".+?(?=<\s*/\s*style\s*>)"> | ||||
|         <using lexer="CSS"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="attr"> | ||||
|       <rule pattern="".*?""> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="'.*?'"> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^\s>]+"> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern="[^<&]+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="&\S*?;"> | ||||
|         <token type="NameEntity"/> | ||||
|       </rule> | ||||
|       <rule pattern="\<\!\[CDATA\[.*?\]\]\>"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="<!--"> | ||||
|         <token type="Comment"/> | ||||
|         <push state="comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="<\?.*?\?>"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="<![^>]*>"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<)(\s*)(script)(\s*)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|         <push state="script-content" state="tag"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<)(\s*)(style)(\s*)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|         <push state="style-content" state="tag"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<)(\s*)([\w:.-]+)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|         <push state="tag"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<)(\s*)(/)(\s*)([\w:.-]+)(\s*)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="comment"> | ||||
|       <rule pattern="[^-]+"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="-->"> | ||||
|         <token type="Comment"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="-"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="tag"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="([\w:-]+\s*)(=)(\s*)"> | ||||
|         <bygroups> | ||||
|           <token type="NameAttribute"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|         <push state="attr"/> | ||||
|       </rule> | ||||
|       <rule pattern="[\w:-]+"> | ||||
|         <token type="NameAttribute"/> | ||||
|       </rule> | ||||
|       <rule pattern="(/?)(\s*)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										128
									
								
								lexers/embedded/makefile.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								lexers/embedded/makefile.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,128 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Makefile</name> | ||||
|     <alias>make</alias> | ||||
|     <alias>makefile</alias> | ||||
|     <alias>mf</alias> | ||||
|     <alias>bsdmake</alias> | ||||
|     <filename>*.mak</filename> | ||||
|     <filename>*.mk</filename> | ||||
|     <filename>Makefile</filename> | ||||
|     <filename>makefile</filename> | ||||
|     <filename>Makefile.*</filename> | ||||
|     <filename>GNUmakefile</filename> | ||||
|     <filename>BSDmakefile</filename> | ||||
|     <mime_type>text/x-makefile</mime_type> | ||||
|     <ensure_nl>true</ensure_nl> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="^(?:[\t ]+.*\n|\n)+"> | ||||
|         <using lexer="Bash"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$[<@$+%?|*]"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="#.*?\n"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="(export)(\s+)(?=[\w${}\t -]+\n)"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|         <push state="export"/> | ||||
|       </rule> | ||||
|       <rule pattern="export\s+"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)"> | ||||
|         <bygroups> | ||||
|           <token type="NameVariable"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Text"/> | ||||
|           <using lexer="Bash"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)"(\\\\|\\.|[^"\\])*""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)'(\\\\|\\.|[^'\\])*'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="([^\n:]+)(:+)([ \t]*)"> | ||||
|         <bygroups> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|         <push state="block-header"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$\("> | ||||
|         <token type="Keyword"/> | ||||
|         <push state="expansion"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="expansion"> | ||||
|       <rule pattern="[^$a-zA-Z_()]+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="[a-zA-Z_]+"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\("> | ||||
|         <token type="Keyword"/> | ||||
|         <push/> | ||||
|       </rule> | ||||
|       <rule pattern="\)"> | ||||
|         <token type="Keyword"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="export"> | ||||
|       <rule pattern="[\w${}-]+"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="block-header"> | ||||
|       <rule pattern="[,|]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="#.*?\n"> | ||||
|         <token type="Comment"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="\\\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$\("> | ||||
|         <token type="Keyword"/> | ||||
|         <push state="expansion"/> | ||||
|       </rule> | ||||
|       <rule pattern="[a-zA-Z_]+"> | ||||
|         <token type="Name"/> | ||||
|       </rule> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="."> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										120
									
								
								lexers/embedded/mako.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								lexers/embedded/mako.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Mako</name> | ||||
|     <alias>mako</alias> | ||||
|     <filename>*.mao</filename> | ||||
|     <mime_type>application/x-mako</mime_type> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="(\s*)(%)(\s*end(?:\w+))(\n|\Z)"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Other"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s*)(%)([^\n]*)(\n|\Z)"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="Python"/> | ||||
|           <token type="Other"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s*)(##[^\n]*)(\n|\Z)"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <token type="Other"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)<%doc>.*?</%doc>"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<%)([\w.:]+)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <token type="NameBuiltin"/> | ||||
|         </bygroups> | ||||
|         <push state="tag"/> | ||||
|       </rule> | ||||
|       <rule pattern="(</%)([\w.:]+)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <token type="NameBuiltin"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="<%(?=([\w.:]+))"> | ||||
|         <token type="CommentPreproc"/> | ||||
|         <push state="ondeftags"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<%(?:!?))(.*?)(%>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="Python"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\$\{)(.*?)(\})"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="Python"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?sx)
                (.+?)                # anything, followed by:
                (?:
                 (?<=\n)(?=%|\#\#) | # an eval or comment line
                 (?=\#\*) |          # multiline comment
                 (?=</?%) |          # a python block
                                     # call start or end
                 (?=\$\{) |          # a substitution
                 (?<=\n)(?=\s*%) |
                                     # - don't consume
                 (\\\n) |            # an escaped newline
                 \Z                  # end of string
                )
            "> | ||||
|         <bygroups> | ||||
|           <token type="Other"/> | ||||
|           <token type="Operator"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="ondeftags"> | ||||
|       <rule pattern="<%"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=<%)(include|inherit|namespace|page)"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="tag"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="tag"> | ||||
|       <rule pattern="((?:\w+)\s*=)(\s*)(".*?")"> | ||||
|         <bygroups> | ||||
|           <token type="NameAttribute"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="/?\s*>"> | ||||
|         <token type="CommentPreproc"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="attr"> | ||||
|       <rule pattern="".*?""> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="'.*?'"> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^\s>]+"> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										89
									
								
								lexers/embedded/mason.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								lexers/embedded/mason.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Mason</name> | ||||
|     <alias>mason</alias> | ||||
|     <filename>*.m</filename> | ||||
|     <filename>*.mhtml</filename> | ||||
|     <filename>*.mc</filename> | ||||
|     <filename>*.mi</filename> | ||||
|     <filename>autohandler</filename> | ||||
|     <filename>dhandler</filename> | ||||
|     <mime_type>application/x-mason</mime_type> | ||||
|     <priority>0.1</priority> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<%doc>)(.*?)(</%doc>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="CommentMultiline"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="NameTag"/> | ||||
|           <usingself state="root"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="NameTag"/> | ||||
|           <using lexer="Perl"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<&[^|])(.*?)(,.*?)?(&>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <using lexer="Perl"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<&\|)(.*?)(,.*?)?(&>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <using lexer="Perl"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="</&>"> | ||||
|         <token type="NameTag"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<%!?)(.*?)(%>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <using lexer="Perl"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=^)#[^\n]*(\n|\Z)"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=^)(%)([^\n]*)(\n|\Z)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <using lexer="Perl"/> | ||||
|           <token type="Other"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?sx)
                 (.+?)               # anything, followed by:
                 (?:
                  (?<=\n)(?=[%#]) |  # an eval or comment line
                  (?=</?[%&]) |      # a substitution or block or
                                     # call start or end
                                     # - don't consume
                  (\\\n) |           # an escaped newline
                  \Z                 # end of string
                 )"> | ||||
|         <bygroups> | ||||
|           <using lexer="HTML"/> | ||||
|           <token type="Operator"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										77
									
								
								lexers/embedded/myghty.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								lexers/embedded/myghty.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Myghty</name> | ||||
|     <alias>myghty</alias> | ||||
|     <filename>*.myt</filename> | ||||
|     <filename>autodelegate</filename> | ||||
|     <mime_type>application/x-myghty</mime_type> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="NameTag"/> | ||||
|           <usingself state="root"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="NameTag"/> | ||||
|           <using lexer="Python2"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<&[^|])(.*?)(,.*?)?(&>)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <using lexer="Python2"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<&\|)(.*?)(,.*?)?(&>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <using lexer="Python2"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="</&>"> | ||||
|         <token type="NameTag"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<%!?)(.*?)(%>)(?s)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <using lexer="Python2"/> | ||||
|           <token type="NameTag"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=^)#[^\n]*(\n|\Z)"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=^)(%)([^\n]*)(\n|\Z)"> | ||||
|         <bygroups> | ||||
|           <token type="NameTag"/> | ||||
|           <using lexer="Python2"/> | ||||
|           <token type="Other"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?sx)
                 (.+?)               # anything, followed by:
                 (?:
                  (?<=\n)(?=[%#]) |  # an eval or comment line
                  (?=</?[%&]) |      # a substitution or block or
                                     # call start or end
                                     # - don't consume
                  (\\\n) |           # an escaped newline
                  \Z                 # end of string
                 )"> | ||||
|         <bygroups> | ||||
|           <token type="Other"/> | ||||
|           <token type="Operator"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										101
									
								
								lexers/embedded/openedge_abl.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								lexers/embedded/openedge_abl.xml
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										329
									
								
								lexers/embedded/org_mode.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										329
									
								
								lexers/embedded/org_mode.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,329 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Org Mode</name> | ||||
|     <alias>org</alias> | ||||
|     <alias>orgmode</alias> | ||||
|     <filename>*.org</filename> | ||||
|     <mime_type>text/org</mime_type> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="^# .*$"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*)( COMMENT)( .*)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="NameEntity"/> | ||||
|           <token type="GenericStrong"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*\*+)( COMMENT)( .*)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericSubheading"/> | ||||
|           <token type="NameEntity"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*)( DONE)( .*)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="LiteralStringRegex"/> | ||||
|           <token type="GenericStrong"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*\*+)( DONE)( .*)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericSubheading"/> | ||||
|           <token type="LiteralStringRegex"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*)( TODO)( .*)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="Error"/> | ||||
|           <token type="GenericStrong"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*\*+)( TODO)( .*)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericSubheading"/> | ||||
|           <token type="Error"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*)( .+?)( :[a-zA-Z0-9_@:]+:)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="GenericStrong"/> | ||||
|           <token type="GenericEmph"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*)( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="GenericStrong"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*\*+)( .+?)( :[a-zA-Z0-9_@:]+:)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericSubheading"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="GenericEmph"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(\*\*+)( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="GenericSubheading"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( *)([+-] )(\[[ X]\])( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( +)(\* )(\[[ X]\])( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( *)([+-] )([^ \n]+ ::)( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( +)(\* )([^ \n]+ ::)( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( *)([+-] )(.+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( +)(\* )(.+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( *)([0-9]+[.)])( \[@[0-9]+\])( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="GenericEmph"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( *)([0-9]+[.)])( .+)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="Keyword"/> | ||||
|           <usingself state="inline"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *#\+begin: )([^ ]+)([\w\W]*?\n)([\w\W]*?)(^ *#\+end: *$)"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|           <token type="CommentSpecial"/> | ||||
|           <token type="Comment"/> | ||||
|           <usingself state="inline"/> | ||||
|           <token type="Comment"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *#\+begin_comment *\n)([\w\W]*?)(^ *#\+end_comment *$)"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|           <token type="Comment"/> | ||||
|           <token type="Comment"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *#\+begin_src )([^ \n]+)(.*?\n)([\w\W]*?)(^ *#\+end_src *$)"> | ||||
|         <usingbygroup> | ||||
|           <sublexer_name_group>2</sublexer_name_group> | ||||
|           <code_group>4</code_group> | ||||
|           <emitters> | ||||
|             <token type="Comment"/> | ||||
|             <token type="CommentSpecial"/> | ||||
|             <token type="Comment"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="Comment"/> | ||||
|           </emitters> | ||||
|         </usingbygroup> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *#\+begin_export )(\w+)( *\n)([\w\W]*?)(^ *#\+end_export *$)"> | ||||
|         <usingbygroup> | ||||
|           <sublexer_name_group>2</sublexer_name_group> | ||||
|           <code_group>4</code_group> | ||||
|           <emitters> | ||||
|             <token type="Comment"/> | ||||
|             <token type="CommentSpecial"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="Comment"/> | ||||
|           </emitters> | ||||
|         </usingbygroup> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *#\+begin_)(\w+)( *\n)([\w\W]*?)(^ *#\+end_\2)( *$)"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|           <token type="Comment"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Comment"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(#\+\w+)(:.*)$"> | ||||
|         <bygroups> | ||||
|           <token type="CommentSpecial"/> | ||||
|           <token type="Comment"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *:\w+: *\n)([\w\W]*?)(^ *:end: *$)"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|           <token type="CommentSpecial"/> | ||||
|           <token type="Comment"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^(.*)(\\\\)$"> | ||||
|         <bygroups> | ||||
|           <usingself state="inline"/> | ||||
|           <token type="Operator"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *(?:DEADLINE|SCHEDULED): )(<[^<>]+?> *)$"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|           <token type="CommentSpecial"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?i)^( *CLOSED: )(\[[^][]+?\] *)$"> | ||||
|         <bygroups> | ||||
|           <token type="Comment"/> | ||||
|           <token type="CommentSpecial"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="inline"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="inline"> | ||||
|       <rule pattern="(\s)*(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="GenericStrong"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s)*(/[^/]+?/)((?=\W|\n|$))"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="GenericEmph"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s)*(=[^\n=]+?=)((?=\W|\n|$))"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameClass"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s)*(~[^\n~]+?~)((?=\W|\n|$))"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameClass"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s)*(\+[^+]+?\+)((?=\W|\n|$))"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="GenericDeleted"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\s)*(_[^_]+?_)((?=\W|\n|$))"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="GenericUnderline"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<)([^<>]+?)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="LiteralString"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="[{]{3}[^}]+[}]{3}"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="([^[])(\[fn:)([^]]+?)(\])([^]])"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameBuiltinPseudo"/> | ||||
|           <token type="LiteralString"/> | ||||
|           <token type="NameBuiltinPseudo"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\[\[)([^][]+?)(\]\[)([^][]+)(\]\])"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameAttribute"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameTag"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\[\[)([^][]+?)(\]\])"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameAttribute"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(<<)([^<>]+?)(>>)"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="NameAttribute"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^( *)(\|[ -].*?[ -]\|)$"> | ||||
|         <bygroups> | ||||
|           <token type="Text"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="."> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										21
									
								
								lexers/embedded/plaintext.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								lexers/embedded/plaintext.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>plaintext</name> | ||||
|     <alias>text</alias> | ||||
|     <alias>plain</alias> | ||||
|     <alias>no-highlight</alias> | ||||
|     <filename>*.txt</filename> | ||||
|     <mime_type>text/plain</mime_type> | ||||
|     <priority>-1</priority> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern=".+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										155
									
								
								lexers/embedded/postgresql_sql_dialect.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										155
									
								
								lexers/embedded/postgresql_sql_dialect.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,155 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>PostgreSQL SQL dialect</name> | ||||
|     <alias>postgresql</alias> | ||||
|     <alias>postgres</alias> | ||||
|     <mime_type>text/x-postgresql</mime_type> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|     <not_multiline>true</not_multiline> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="--.*\n?"> | ||||
|         <token type="CommentSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="/\*"> | ||||
|         <token type="CommentMultiline"/> | ||||
|         <push state="multiline-comments"/> | ||||
|       </rule> | ||||
|       <rule pattern="(bigint|bigserial|bit|bit\s+varying|bool|boolean|box|bytea|char|character|character\s+varying|cidr|circle|date|decimal|double\s+precision|float4|float8|inet|int|int2|int4|int8|integer|interval|json|jsonb|line|lseg|macaddr|money|numeric|path|pg_lsn|point|polygon|real|serial|serial2|serial4|serial8|smallint|smallserial|text|time|timestamp|timestamptz|timetz|tsquery|tsvector|txid_snapshot|uuid|varbit|varchar|with\s+time\s+zone|without\s+time\s+zone|xml|anyarray|anyelement|anyenum|anynonarray|anyrange|cstring|fdw_handler|internal|language_handler|opaque|record|void)\b"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)(DO)(\s+)(?:(LANGUAGE)?(\s+)('?)(\w+)?('?)(\s+))?(\$)([^$]*)(\$)(.*?)(\$)(\10)(\$)"> | ||||
|         <usingbygroup> | ||||
|           <sublexer_name_group>6</sublexer_name_group> | ||||
|           <code_group>12</code_group> | ||||
|           <emitters> | ||||
|             <token type="Keyword"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="Keyword"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="LiteralStringSingle"/> | ||||
|             <token type="LiteralStringSingle"/> | ||||
|             <token type="LiteralStringSingle"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|           </emitters> | ||||
|         </usingbygroup> | ||||
|       </rule> | ||||
|       <rule pattern="(CURRENT_TIMESTAMP|CHARACTERISTICS|CURRENT_CATALOG|CURRENT_SCHEMA|LOCALTIMESTAMP|CONFIGURATION|AUTHORIZATION|XMLATTRIBUTES|MATERIALIZED|SERIALIZABLE|CURRENT_DATE|XMLSERIALIZE|SESSION_USER|CURRENT_ROLE|CURRENT_USER|CONCURRENTLY|CURRENT_TIME|UNENCRYPTED|UNCOMMITTED|TRANSACTION|INSENSITIVE|CONSTRAINTS|ASSIGNMENT|ASYMMETRIC|DEALLOCATE|ORDINALITY|PRIVILEGES|DEFERRABLE|PROCEDURAL|CONVERSION|REFERENCES|WHITESPACE|TABLESPACE|CONSTRAINT|CONNECTION|STATISTICS|DELIMITERS|STANDALONE|DICTIONARY|REPEATABLE|CHECKPOINT|XMLELEMENT|LC_COLLATE|SYMMETRIC|PARTITION|SEQUENCES|FUNCTIONS|IMMEDIATE|IMMUTABLE|SAVEPOINT|EXTENSION|INCLUDING|RETURNING|COLLATION|INCREMENT|EXCLUSIVE|EXCLUDING|INITIALLY|COMMITTED|INTERSECT|STATEMENT|SUBSTRING|FOLLOWING|ISOLATION|TEMPORARY|ENCRYPTED|TIMESTAMP|RECURSIVE|LEAKPROOF|PROCEDURE|LOCALTIME|XMLFOREST|XMLEXISTS|AGGREGATE|ATTRIBUTE|UNBOUNDED|ASSERTION|XMLCONCAT|DELIMITER|CHARACTER|VALIDATOR|PRECISION|PRECEDING|LC_CTYPE|SECURITY|PREPARED|PASSWORD|VALIDATE|OVERLAPS|VARIADIC|DEFAULTS|VOLATILE|DEFERRED|OPERATOR|NATIONAL|UNLOGGED|UNLISTEN|TRAILING|BACKWARD|MAXVALUE|PRESERVE|DISTINCT|LOCATION|DOCUMENT|TRUNCATE|MINVALUE|POSITION|ABSOLUTE|XMLPARSE|LANGUAGE|ENCODING|CONTINUE|TEMPLATE|INTERVAL|CASCADED|DATABASE|RELATIVE|INHERITS|COMMENTS|SNAPSHOT|RESTRICT|COALESCE|IMPLICIT|ROLLBACK|EXTERNAL|REASSIGN|SMALLINT|IDENTITY|GREATEST|SEQUENCE|FUNCTION|DISCARD|CASCADE|DECIMAL|XMLROOT|FOREIGN|FORWARD|PARTIAL|PLACING|WRAPPER|WITHOUT|OVERLAY|DECLARE|PREPARE|GRANTED|CURRENT|DEFAULT|HANDLER|PRIMARY|OPTIONS|VERSION|VERBOSE|DEFINER|VARYING|ANALYSE|VARCHAR|EXTRACT|EXPLAIN|PROGRAM|RECHECK|EXECUTE|ANALYZE|INDEXES|INHERIT|EXCLUDE|CONTENT|REFRESH|REINDEX|NUMERIC|UNKNOWN|RELEASE|NOTNULL|INSTEAD|TRUSTED|INTEGER|NOTHING|COMMENT|TRIGGER|INVOKER|BETWEEN|REPLACE|REPLICA|RESTART|BOOLEAN|NATURAL|COLLATE|RETURNS|CLUSTER|LATERAL|STORAGE|DISABLE|LEADING|MAPPING|PASSING|SESSION|CATALOG|SIMILAR|SIMPLE|LISTEN|STABLE|SERVER|DOUBLE|DOMAIN|SELECT|SECOND|CALLED|SEARCH|SCROLL|STDOUT|MINUTE|SCHEMA|STRICT|REVOKE|SYSTEM|ENABLE|COLUMN|DELETE|TABLES|BINARY|BIGINT|ISNULL|BEFORE|RENAME|ESCAPE|NOTIFY|INSERT|NOWAIT|UNIQUE|NULLIF|COMMIT|UPDATE|OBJECT|VACUUM|INLINE|OFFSET|EXCEPT|EXISTS|VALUES|FAMILY|OPTION|HEADER|CREATE|HAVING|ALWAYS|WINDOW|CURSOR|WITHIN|GLOBAL|FILTER|POLICY|ACTION|PARSER|FREEZE|ACCESS|LOCAL|LEAST|OWNER|PLANS|OWNED|FORCE|XMLPI|CYCLE|ADMIN|OUTER|AFTER|ORDER|PRIOR|WRITE|CROSS|FIRST|GRANT|QUOTE|RANGE|FETCH|ALTER|WHERE|GROUP|VIEWS|ILIKE|FALSE|VALUE|INDEX|NULLS|VALID|INNER|USING|INOUT|UNTIL|RESET|NCHAR|NAMES|ARRAY|INPUT|MONTH|RIGHT|EVENT|UNION|TYPES|TREAT|BEGIN|CLOSE|LABEL|ABORT|MATCH|TABLE|CLASS|LARGE|CHECK|SYSID|CHAIN|FLOAT|STRIP|LIMIT|STDIN|SETOF|SHARE|CACHE|START|LEVEL|NAME|MOVE|SOME|LEFT|CAST|LIKE|DROP|SHOW|ZONE|EACH|ELSE|LAST|LOAD|YEAR|BOTH|CHAR|DATA|LOCK|DESC|FROM|TEMP|OVER|JOIN|TEXT|THEN|TIME|ALSO|FULL|WORK|RULE|ROWS|INTO|TRIM|TRUE|ENUM|ONLY|TYPE|WITH|READ|REAL|COST|MODE|ROLE|CASE|WHEN|COPY|NEXT|VIEW|USER|NONE|HOLD|NULL|HOUR|OIDS|BIT|ADD|SET|YES|FOR|AND|NOT|DAY|ANY|KEY|DEC|END|ASC|OFF|ROW|INT|REF|OUT|ALL|CSV|XML|ON|AT|NO|TO|AS|IN|DO|IS|IF|BY|OR|OF)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="[+*/<>=~!@#%^&|`?-]+"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="::"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$\d+"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9]+"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern="((?:E|U&)?)(')"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralStringSingle"/> | ||||
|         </bygroups> | ||||
|         <push state="string"/> | ||||
|       </rule> | ||||
|       <rule pattern="((?:U&)?)(")"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralStringName"/> | ||||
|         </bygroups> | ||||
|         <push state="quoted-ident"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)(\s+)(LANGUAGE)?(\s+)('?)(\w+)?('?)"> | ||||
|         <usingbygroup> | ||||
|           <sublexer_name_group>12</sublexer_name_group> | ||||
|           <code_group>4</code_group> | ||||
|           <emitters> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="LiteralStringHeredoc"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="Keyword"/> | ||||
|             <token type="Text"/> | ||||
|             <token type="LiteralStringSingle"/> | ||||
|             <token type="LiteralStringSingle"/> | ||||
|             <token type="LiteralStringSingle"/> | ||||
|           </emitters> | ||||
|         </usingbygroup> | ||||
|       </rule> | ||||
|       <rule pattern="(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)"> | ||||
|         <token type="LiteralStringHeredoc"/> | ||||
|       </rule> | ||||
|       <rule pattern="[a-z_]\w*"> | ||||
|         <token type="Name"/> | ||||
|       </rule> | ||||
|       <rule pattern=":(['"]?)[a-z]\w*\b\1"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="[;:()\[\]{},.]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="multiline-comments"> | ||||
|       <rule pattern="/\*"> | ||||
|         <token type="CommentMultiline"/> | ||||
|         <push state="multiline-comments"/> | ||||
|       </rule> | ||||
|       <rule pattern="\*/"> | ||||
|         <token type="CommentMultiline"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^/*]+"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|       <rule pattern="[/*]"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string"> | ||||
|       <rule pattern="[^']+"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="''"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="quoted-ident"> | ||||
|       <rule pattern="[^"]+"> | ||||
|         <token type="LiteralStringName"/> | ||||
|       </rule> | ||||
|       <rule pattern=""""> | ||||
|         <token type="LiteralStringName"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringName"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
| @@ -6,6 +6,33 @@ | ||||
|     <filename>*.proto</filename> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="package"> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="NameNamespace"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="message"> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="NameClass"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="type"> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="Name"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern="[ \t]+"> | ||||
|         <token type="Text"/> | ||||
| @@ -87,32 +114,5 @@ | ||||
|         <token type="Name"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="package"> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="NameNamespace"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="message"> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="NameClass"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="type"> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="Name"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										79
									
								
								lexers/embedded/smarty.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								lexers/embedded/smarty.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Smarty</name> | ||||
|     <alias>smarty</alias> | ||||
|     <filename>*.tpl</filename> | ||||
|     <mime_type>application/x-smarty</mime_type> | ||||
|     <dot_all>true</dot_all> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="[^{]+"> | ||||
|         <token type="Other"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\{)(\*.*?\*)(\})"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <token type="Comment"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\{php\})(.*?)(\{/php\})"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <using lexer="PHP"/> | ||||
|           <token type="CommentPreproc"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\{)(/?[a-zA-Z_]\w*)(\s*)"> | ||||
|         <bygroups> | ||||
|           <token type="CommentPreproc"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|         <push state="smarty"/> | ||||
|       </rule> | ||||
|       <rule pattern="\{"> | ||||
|         <token type="CommentPreproc"/> | ||||
|         <push state="smarty"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="smarty"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\{"> | ||||
|         <token type="CommentPreproc"/> | ||||
|         <push/> | ||||
|       </rule> | ||||
|       <rule pattern="\}"> | ||||
|         <token type="CommentPreproc"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="#[a-zA-Z_]\w*#"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$[a-zA-Z_]\w*(\.\w+)*"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|       <rule pattern="[~!%^&*()+=|\[\]:;,.<>/?@-]"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="(true|false|null)\b"> | ||||
|         <token type="KeywordConstant"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?"> | ||||
|         <token type="LiteralNumber"/> | ||||
|       </rule> | ||||
|       <rule pattern=""(\\\\|\\"|[^"])*""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|       <rule pattern="'(\\\\|\\'|[^'])*'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="[a-zA-Z_]\w*"> | ||||
|         <token type="NameAttribute"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										178
									
								
								lexers/embedded/typoscript.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								lexers/embedded/typoscript.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,178 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>TypoScript</name> | ||||
|     <alias>typoscript</alias> | ||||
|     <filename>*.ts</filename> | ||||
|     <mime_type>text/x-typoscript</mime_type> | ||||
|     <dot_all>true</dot_all> | ||||
|     <priority>0.1</priority> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="whitespace"> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="html"> | ||||
|       <rule pattern="<\S[^\n>]*>"> | ||||
|         <using lexer="TypoScriptHTMLData"/> | ||||
|       </rule> | ||||
|       <rule pattern="&[^;\n]*;"> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="(_CSS_DEFAULT_STYLE)(\s*)(\()(?s)(.*(?=\n\)))"> | ||||
|         <bygroups> | ||||
|           <token type="NameClass"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|           <using lexer="TypoScriptCSSData"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="operator"> | ||||
|       <rule pattern="[<>,:=.*%+|]"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="structure"> | ||||
|       <rule pattern="[{}()\[\]\\]"> | ||||
|         <token type="LiteralStringSymbol"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="constant"> | ||||
|       <rule pattern="(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="NameConstant"/> | ||||
|           <token type="NameConstant"/> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|           <token type="NameConstant"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="NameConstant"/> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(#[a-fA-F0-9]{6}\b|#[a-fA-F0-9]{3}\b)"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="comment"> | ||||
|       <rule pattern="(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="/\*(?:(?!\*/).)*\*/"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\s*#\s*\n)"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule> | ||||
|         <include state="comment"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="constant"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="html"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="label"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="whitespace"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="keywords"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="punctuation"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="operator"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="structure"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="literal"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="other"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="literal"> | ||||
|       <rule pattern="0x[0-9A-Fa-f]+t?"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9]+"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern="(###\w+###)"> | ||||
|         <token type="NameConstant"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="label"> | ||||
|       <rule pattern="(EXT|FILE|LLL):[^}\n"]*"> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?![^\w\-])([\w\-]+(?:/[\w\-]+)+/?)(\S*\n)"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralString"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="punctuation"> | ||||
|       <rule pattern="[,.]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="other"> | ||||
|       <rule pattern="[\w"\-!/&;]+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="keywords"> | ||||
|       <rule pattern="(\[)(?i)(browser|compatVersion|dayofmonth|dayofweek|dayofyear|device|ELSE|END|GLOBAL|globalString|globalVar|hostname|hour|IP|language|loginUser|loginuser|minute|month|page|PIDinRootline|PIDupinRootline|system|treeLevel|useragent|userFunc|usergroup|version)([^\]]*)(\])"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|           <token type="NameConstant"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="LiteralStringSymbol"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?=[\w\-])(HTMLparser|HTMLparser_tags|addParams|cache|encapsLines|filelink|if|imageLinkWrap|imgResource|makelinks|numRows|numberFormat|parseFunc|replacement|round|select|split|stdWrap|strPad|tableStyle|tags|textStyle|typolink)(?![\w\-])"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?:(=?\s*<?\s+|^\s*))(cObj|field|config|content|constants|FEData|file|frameset|includeLibs|lib|page|plugin|register|resources|sitemap|sitetitle|styles|temp|tt_[^:.\s]*|types|xmlnews|INCLUDE_TYPOSCRIPT|_CSS_DEFAULT_STYLE|_DEFAULT_PI_VARS|_LOCAL_LANG)(?![\w\-])"> | ||||
|         <bygroups> | ||||
|           <token type="Operator"/> | ||||
|           <token type="NameBuiltin"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(?=[\w\-])(CASE|CLEARGIF|COA|COA_INT|COBJ_ARRAY|COLUMNS|CONTENT|CTABLE|EDITPANEL|FILE|FILES|FLUIDTEMPLATE|FORM|HMENU|HRULER|HTML|IMAGE|IMGTEXT|IMG_RESOURCE|LOAD_REGISTER|MEDIA|MULTIMEDIA|OTABLE|PAGE|QTOBJECT|RECORDS|RESTORE_REGISTER|SEARCHRESULT|SVG|SWFOBJECT|TEMPLATE|TEXT|USER|USER_INT)(?![\w\-])"> | ||||
|         <token type="NameClass"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?=[\w\-])(ACTIFSUBRO|ACTIFSUB|ACTRO|ACT|CURIFSUBRO|CURIFSUB|CURRO|CUR|IFSUBRO|IFSUB|NO|SPC|USERDEF1RO|USERDEF1|USERDEF2RO|USERDEF2|USRRO|USR)"> | ||||
|         <token type="NameClass"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?=[\w\-])(GMENU_FOLDOUT|GMENU_LAYERS|GMENU|IMGMENUITEM|IMGMENU|JSMENUITEM|JSMENU|TMENUITEM|TMENU_LAYERS|TMENU)"> | ||||
|         <token type="NameClass"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?=[\w\-])(PHP_SCRIPT(_EXT|_INT)?)"> | ||||
|         <token type="NameClass"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?=[\w\-])(userFunc)(?![\w\-])"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										355
									
								
								lexers/embedded/v.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										355
									
								
								lexers/embedded/v.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,355 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>V</name> | ||||
|     <alias>v</alias> | ||||
|     <alias>vlang</alias> | ||||
|     <filename>*.v</filename> | ||||
|     <filename>*.vv</filename> | ||||
|     <filename>v.mod</filename> | ||||
|     <mime_type>text/x-v</mime_type> | ||||
|     <ensure_nl>true</ensure_nl> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\\\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=module\s+\w[^\n]*\s+)(//[^\n]+\n)+(?=\n)"> | ||||
|         <token type="LiteralStringDoc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(// *)(\w+)([^\n]+\n)(?=(?://[^\n]*\n)* *(?:pub +)?(?:fn|struct|union|type|interface|enum|const) +\2\b)"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringDoc"/> | ||||
|           <token type="GenericEmph"/> | ||||
|           <token type="LiteralStringDoc"/> | ||||
|         </bygroups> | ||||
|         <push state="string-doc"/> | ||||
|       </rule> | ||||
|       <rule pattern="//[^\n]*\n"> | ||||
|         <token type="CommentSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="/\*(?:(?:/\*(?:.|\n)*?\*/)*|.|\n)*\*/"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(import|module)\b"> | ||||
|         <token type="KeywordNamespace"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(fn|struct|union|map|chan|type|interface|enum|const|mut|shared|pub|__global)\b"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="\?"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\)\s*)!"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="[ \t]*#include[^\n]+"> | ||||
|         <using lexer="c"/> | ||||
|       </rule> | ||||
|       <rule pattern="[ \t]*#\w[^\n]*"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(sql)(\s+)(\w+)(\s+)({)([^}]*?)(})"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Name"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <using lexer="sql"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="\$(?=\w)"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\$)(?:embed_file|pkgconfig|tmpl|env|compile_error|compile_warn)"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(asm)(\s+)(\w+)(\s*)({)([^}]*?)(})"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="KeywordType"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <using lexer="nasm"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="\b_(?:un)?likely_(?=\()"> | ||||
|         <token type="NameFunctionMagic"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\$if.+?(?:&&|\|\|)?)((no_segfault_handler|no_bounds_checking|little_endian|freestanding|no_backtrace|big_endian|cplusplus|dragonfly|prealloc|android|windows|no_main|solaris|darwin|clang|tinyc|glibc|mingw|haiku|macos|amd64|arm64|debug|linux|prod|msvc|test|hpux|mach|x32|x64|gcc|qnx|gnu|ios|mac|js))+"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="@(VMOD_FILE|VEXEROOT|VMODROOT|METHOD|STRUCT|COLUMN|VHASH|FILE|LINE|VEXE|MOD|FN)\b"> | ||||
|         <token type="NameVariableMagic"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(__offsetof|isreftype|continue|volatile|typeof|static|unsafe|return|assert|sizeof|atomic|select|match|break|defer|rlock|lock|else|goto|for|in|is|as|or|if|go)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(none|true|false|si_s_code|si_g32_code|si_g64_code)\b"> | ||||
|         <token type="KeywordConstant"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(vstring_literal_with_len|utf8_str_visible_length|get_str_intp_u64_format|get_str_intp_u32_format|utf32_decode_to_buffer|utf32_to_str_no_malloc|panic_optional_not_set|panic_result_not_set|contains_any_substr|strip_margin_custom|starts_with_capital|cstring_to_vstring|winapi_lasterr_str|c_error_number_str|panic_error_number|substr_with_check|string_from_wide2|sort_with_compare|trim_string_right|string_from_wide|sort_ignore_case|trim_string_left|reverse_in_place|split_into_lines|vstring_with_len|compare_strings|all_before_last|print_backtrace|repeat_to_depth|length_in_bytes|error_with_code|vstring_literal|gc_check_leaks|clone_to_depth|vcalloc_noscan|all_after_last|utf8_char_len|panic_lasterr|memdup_noscan|malloc_noscan|str_intp_rune|last_index_u8|utf8_to_utf32|flush_stderr|flush_stdout|str_intp_sub|replace_each|replace_once|vstrlen_char|utf8_getchar|str_intp_g64|contains_any|find_between|realloc_data|strip_margin|utf32_to_str|is_bin_digit|is_hex_digit|is_oct_digit|proc_pidpath|str_intp_g32|delete_many|delete_last|str_escaped|index_after|sort_by_len|str_intp_sq|starts_with|trim_space|last_index|parse_uint|is_capital|trim_right|join_lines|capitalize|all_before|after_char|match_glob|utf32_code|eq_epsilon|tos_clone|substr_ni|v_realloc|push_many|is_letter|split_nth|split_any|trim_left|index_any|ascii_str|parse_int|all_after|ends_with|is_title|contains|eprintln|is_space|index_u8|is_digit|vmemmove|byterune|is_alnum|pointers|grow_len|is_lower|grow_cap|str_intp|to_upper|hex_full|len_utf8|is_upper|try_push|to_lower|compare|vmemset|try_pop|vcalloc|reverse|vmemcmp|vstring|replace|ptr_str|strlong|to_wide|bytestr|f32_abs|f32_max|println|f32_min|f64_max|vmemcpy|vstrlen|prepend|vbytes|strsci|substr|string|insert|eprint|filter|delete|repeat|malloc|memdup|fields|before|reduce|string|isize|count|index|title|bytes|clone|usize|error|after|split|runes|print|panic|first|close|limit|isnil|bool|rune|tos3|u128|hex2|i128|hash|code|tos4|free|exit|keys|tos2|last|trim|strg|tos5|move|copy|drop|sort|dump|join|free|cap|int|any|all|any|len|map|pop|hex|f64|f32|u16|msg|i64|i16|u32|str|tos|u64|i8|u8)(?=\()"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(StrIntpCgenData|VAssertMetaInfo|StructAttribute|AttributeKind|FunctionData|StrIntpData|StrIntpType|MethodArgs|StrIntpMem|ArrayFlags|FieldData|SortedMap|ChanState|string|array|Error|map)\b"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(voidptr|string|error|isize|usize|i128|u128|bool|rune|int|f32|f64|i64|i16|u64|any|u32|u16|i8|u8)\b"> | ||||
|         <token type="KeywordType"/> | ||||
|       </rule> | ||||
|       <rule pattern="\bit\b"> | ||||
|         <token type="NameVariableMagic"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<!fn\s+)(?<=\w+\s+|^)\[(?=:if +)?(?=\w+)"> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="attribute"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<<=|>>=|>>>=|>>>|<<|>>|<=|>=|\^=|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|\.\.|[+\-*/%&|^~=#@!])"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="[\d_]+(\.\d+e[+\-]?\d+|\.\d+|e[+\-]?\d+)"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="\.\d+(e[+\-]?\d+)?"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="0o[0-7_]+"> | ||||
|         <token type="LiteralNumberOct"/> | ||||
|       </rule> | ||||
|       <rule pattern="0x[0-9a-fA-F_]+"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="0b[01_]+"> | ||||
|         <token type="LiteralNumberBin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(0|[1-9][0-9_]*)"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern="`"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|         <push state="char"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="strings"/> | ||||
|       </rule> | ||||
|       <rule pattern="@?[A-Z]\w*"> | ||||
|         <token type="NameClass"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=[^\W\d]\w*)(<)([A-Z]\w*)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="NameClass"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="@?[^\W\d]\w*(?=\()"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=fn\s+)@?[^\W\d]\w*(?=\s*\()"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=(?:continue|break|goto)\s+)\w+"> | ||||
|         <token type="NameLabel"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b[^\W\d]\w*(?=:(?:$|\s+for))"> | ||||
|         <token type="NameLabel"/> | ||||
|       </rule> | ||||
|       <rule pattern="[<>()\[\]{}.,;:]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="@?[^\W\d]\w*"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="char"> | ||||
|       <rule pattern="`"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="char-escape"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^\\]"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-doc"> | ||||
|       <rule pattern="(// *)(#+ [^\n]+)(\n)"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringDoc"/> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="// *([=_*~-])\1{2,}\n"> | ||||
|         <token type="LiteralStringDelimiter"/> | ||||
|       </rule> | ||||
|       <rule pattern="//[^\n]*\n"> | ||||
|         <token type="LiteralStringDoc"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <mutators> | ||||
|           <pop depth="1"/> | ||||
|         </mutators> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-curly-interpolation"> | ||||
|       <rule pattern="}"> | ||||
|         <token type="Punctuation"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="strings"/> | ||||
|       </rule> | ||||
|       <rule pattern="(:)( *?)([ 0'#+-])?(?:(\.)?([0-9]+))?([fFgeEGxXobsd])?"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="LiteralNumber"/> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="[^}"':]+"> | ||||
|         <usingself state="root"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="attribute"> | ||||
|       <rule pattern="\]"> | ||||
|         <token type="Punctuation"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="string-single"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="string-double"/> | ||||
|       </rule> | ||||
|       <rule pattern="[;:]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\[)if\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=: *)\w+"> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^\W\d]\w*"> | ||||
|         <token type="NameAttribute"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="strings"> | ||||
|       <rule pattern="(c)?(")"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralStringDouble"/> | ||||
|         </bygroups> | ||||
|         <push state="string-double"/> | ||||
|       </rule> | ||||
|       <rule pattern="(c)?(')"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralStringSingle"/> | ||||
|         </bygroups> | ||||
|         <push state="string-single"/> | ||||
|       </rule> | ||||
|       <rule pattern="(r)("[^"]+")"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(r)('[^']+')"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-double"> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="char-escape"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\$)((?!\\){)"> | ||||
|         <bygroups> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <push state="string-curly-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$"> | ||||
|         <token type="Operator"/> | ||||
|         <push state="string-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^"]+?"> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-single"> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="char-escape"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\$)((?!\\){)"> | ||||
|         <bygroups> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <push state="string-curly-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$"> | ||||
|         <token type="Operator"/> | ||||
|         <push state="string-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^']+?"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="char-escape"> | ||||
|       <rule pattern="\\[`'"\\abfnrtv$]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}"> | ||||
|         <token type="LiteralStringEscape"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-interpolation"> | ||||
|       <rule pattern="(\.)?(@)?(?:([^\W\d]\w*)(\()([^)]*)(\))|([^\W\d]\w*))"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <usingself state="root"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="NameVariable"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <mutators> | ||||
|           <pop depth="1"/> | ||||
|         </mutators> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										365
									
								
								lexers/embedded/v_shell.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								lexers/embedded/v_shell.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,365 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>V shell</name> | ||||
|     <alias>vsh</alias> | ||||
|     <alias>vshell</alias> | ||||
|     <filename>*.vsh</filename> | ||||
|     <mime_type>text/x-vsh</mime_type> | ||||
|     <ensure_nl>true</ensure_nl> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="attribute"> | ||||
|       <rule pattern="\]"> | ||||
|         <token type="Punctuation"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule pattern="'"> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="string-single"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="string-double"/> | ||||
|       </rule> | ||||
|       <rule pattern="[;:]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\[)if\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=: *)\w+"> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^\W\d]\w*"> | ||||
|         <token type="NameAttribute"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-double"> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="char-escape"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\$)((?!\\){)"> | ||||
|         <bygroups> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <push state="string-curly-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$"> | ||||
|         <token type="Operator"/> | ||||
|         <push state="string-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^"]+?"> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="char"> | ||||
|       <rule pattern="`"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="char-escape"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^\\]"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-doc"> | ||||
|       <rule pattern="(// *)(#+ [^\n]+)(\n)"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringDoc"/> | ||||
|           <token type="GenericHeading"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="// *([=_*~-])\1{2,}\n"> | ||||
|         <token type="LiteralStringDelimiter"/> | ||||
|       </rule> | ||||
|       <rule pattern="//[^\n]*\n"> | ||||
|         <token type="LiteralStringDoc"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <mutators> | ||||
|           <pop depth="1"/> | ||||
|         </mutators> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-interpolation"> | ||||
|       <rule pattern="(\.)?(@)?(?:([^\W\d]\w*)(\()([^)]*)(\))|([^\W\d]\w*))"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="NameFunction"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <usingself state="root"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="NameVariable"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <mutators> | ||||
|           <pop depth="1"/> | ||||
|         </mutators> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-curly-interpolation"> | ||||
|       <rule pattern="}"> | ||||
|         <token type="Punctuation"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="strings"/> | ||||
|       </rule> | ||||
|       <rule pattern="(:)( *?)([ 0'#+-])?(?:(\.)?([0-9]+))?([fFgeEGxXobsd])?"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="LiteralNumber"/> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="[^}"':]+"> | ||||
|         <usingself state="root"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern="^#![^\n]*\n"> | ||||
|         <token type="CommentHashbang"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(path_delimiter|path_separator|wd_at_startup|max_path_len|sys_write|sys_close|sys_mkdir|sys_creat|sys_open|s_iflnk|s_irusr|s_ifdir|s_ixoth|s_isuid|s_isgid|s_isvtx|s_iwoth|s_iwusr|s_ixusr|s_irgrp|s_iwgrp|s_ixgrp|s_iroth|s_ifmt|args)\b"> | ||||
|         <token type="NameConstant"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(ExecutableNotFoundError|FileNotOpenedError|SizeOfTypeIs0Error|ProcessState|SeekMode|Command|Process|Signal|Result|Uname|File)\b"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(find_abs_path_of_executable|posix_set_permission_bit|read_bytes_into_newline|sigint_to_signal_name|exists_in_system_path|get_raw_lines_joined|expand_tilde_to_home|posix_get_error_msg|set_redirect_stdio|is_writable_folder|file_last_mod_unix|walk_with_context|resource_abs_path|debugger_present|write_file_array|join_path_single|execute_or_panic|get_lines_joined|set_environment|read_bytes_into|read_file_array|execute_or_exit|signal_continue|write_struct_at|read_struct_at|vmodules_paths|get_error_msg|signal_pgkill|read_into_ptr|read_bytes_at|existing_path|is_executable|get_raw_stdin|is_dir_empty|write_struct|vmodules_dir|stdout_slurp|write_raw_at|write_string|get_raw_line|stderr_slurp|signal_kill|stderr_read|signal_stop|quoted_path|stdin_write|stdout_read|open_append|new_process|args_before|read_struct|is_writable|is_readable|is_abs_path|read_raw_at|write_file|getenv_opt|args_after|read_lines|read_bytes|signal_opt|config_dir|last_error|executable|file_name|file_size|rmdir_all|write_raw|real_path|join_path|input_opt|norm_path|read_from|get_lines|loginname|read_file|cache_dir|mkdir_all|read_line|open_file|home_dir|hostname|fd_slurp|fd_close|mv_by_cp|open_uri|file_ext|walk_ext|unsetenv|write_to|fd_write|abs_path|read_raw|is_alive|get_line|truncate|temp_dir|set_args|geteuid|is_file|getppid|bitmask|is_atty|execute|symlink|environ|fd_read|is_link|writeln|getegid|user_os|is_dir|stdout|create|fileno|cp_all|system|getenv|vfopen|execve|getgid|stderr|getuid|execvp|exists|setenv|getpid|flush|getwd|input|stdin|mkdir|chdir|chmod|start|chown|rmdir|uname|write|close|utime|inode|wait|seek|base|fork|open|link|glob|read|tell|walk|msg|dir|run|log|cp|mv|rm|ls)(?=\()"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\\\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=module\s+\w[^\n]*\s+)(//[^\n]+\n)+(?=\n)"> | ||||
|         <token type="LiteralStringDoc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(// *)(\w+)([^\n]+\n)(?=(?://[^\n]*\n)* *(?:pub +)?(?:fn|struct|union|type|interface|enum|const) +\2\b)"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringDoc"/> | ||||
|           <token type="GenericEmph"/> | ||||
|           <token type="LiteralStringDoc"/> | ||||
|         </bygroups> | ||||
|         <push state="string-doc"/> | ||||
|       </rule> | ||||
|       <rule pattern="//[^\n]*\n"> | ||||
|         <token type="CommentSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="/\*(?:(?:/\*(?:.|\n)*?\*/)*|.|\n)*\*/"> | ||||
|         <token type="CommentMultiline"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(import|module)\b"> | ||||
|         <token type="KeywordNamespace"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(fn|struct|union|map|chan|type|interface|enum|const|mut|shared|pub|__global)\b"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="\?"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\)\s*)!"> | ||||
|         <token type="KeywordDeclaration"/> | ||||
|       </rule> | ||||
|       <rule pattern="[ \t]*#include[^\n]+"> | ||||
|         <using lexer="c"/> | ||||
|       </rule> | ||||
|       <rule pattern="[ \t]*#\w[^\n]*"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="(sql)(\s+)(\w+)(\s+)({)([^}]*?)(})"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Name"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <using lexer="sql"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="\$(?=\w)"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\$)(?:embed_file|pkgconfig|tmpl|env|compile_error|compile_warn)"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(asm)(\s+)(\w+)(\s*)({)([^}]*?)(})"> | ||||
|         <bygroups> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="KeywordType"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Punctuation"/> | ||||
|           <using lexer="nasm"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="\b_(?:un)?likely_(?=\()"> | ||||
|         <token type="NameFunctionMagic"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\$if.+?(?:&&|\|\|)?)((no_segfault_handler|no_bounds_checking|little_endian|freestanding|no_backtrace|big_endian|cplusplus|dragonfly|prealloc|android|windows|no_main|solaris|darwin|clang|tinyc|glibc|mingw|haiku|macos|amd64|arm64|debug|linux|prod|msvc|test|hpux|mach|x32|x64|gcc|qnx|gnu|ios|mac|js))+"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="@(VMOD_FILE|VEXEROOT|VMODROOT|METHOD|STRUCT|COLUMN|VHASH|FILE|LINE|VEXE|MOD|FN)\b"> | ||||
|         <token type="NameVariableMagic"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(__offsetof|isreftype|continue|volatile|typeof|static|unsafe|return|assert|sizeof|atomic|select|match|break|defer|rlock|lock|else|goto|for|in|is|as|or|if|go)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(none|true|false|si_s_code|si_g32_code|si_g64_code)\b"> | ||||
|         <token type="KeywordConstant"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(vstring_literal_with_len|utf8_str_visible_length|get_str_intp_u64_format|get_str_intp_u32_format|utf32_decode_to_buffer|utf32_to_str_no_malloc|panic_optional_not_set|panic_result_not_set|contains_any_substr|strip_margin_custom|starts_with_capital|cstring_to_vstring|winapi_lasterr_str|c_error_number_str|panic_error_number|substr_with_check|string_from_wide2|sort_with_compare|trim_string_right|string_from_wide|sort_ignore_case|trim_string_left|reverse_in_place|split_into_lines|vstring_with_len|compare_strings|all_before_last|print_backtrace|repeat_to_depth|length_in_bytes|error_with_code|vstring_literal|gc_check_leaks|clone_to_depth|vcalloc_noscan|all_after_last|utf8_char_len|panic_lasterr|memdup_noscan|malloc_noscan|str_intp_rune|last_index_u8|utf8_to_utf32|flush_stderr|flush_stdout|str_intp_sub|replace_each|replace_once|vstrlen_char|utf8_getchar|str_intp_g64|contains_any|find_between|realloc_data|strip_margin|utf32_to_str|is_bin_digit|is_hex_digit|is_oct_digit|proc_pidpath|str_intp_g32|delete_many|delete_last|str_escaped|index_after|sort_by_len|str_intp_sq|starts_with|trim_space|last_index|parse_uint|is_capital|trim_right|join_lines|capitalize|all_before|after_char|match_glob|utf32_code|eq_epsilon|tos_clone|substr_ni|v_realloc|push_many|is_letter|split_nth|split_any|trim_left|index_any|ascii_str|parse_int|all_after|ends_with|is_title|contains|eprintln|is_space|index_u8|is_digit|vmemmove|byterune|is_alnum|pointers|grow_len|is_lower|grow_cap|str_intp|to_upper|hex_full|len_utf8|is_upper|try_push|to_lower|compare|vmemset|try_pop|vcalloc|reverse|vmemcmp|vstring|replace|ptr_str|strlong|to_wide|bytestr|f32_abs|f32_max|println|f32_min|f64_max|vmemcpy|vstrlen|prepend|vbytes|strsci|substr|string|insert|eprint|filter|delete|repeat|malloc|memdup|fields|before|reduce|string|isize|count|index|title|bytes|clone|usize|error|after|split|runes|print|panic|first|close|limit|isnil|bool|rune|tos3|u128|hex2|i128|hash|code|tos4|free|exit|keys|tos2|last|trim|strg|tos5|move|copy|drop|sort|dump|join|free|cap|int|any|all|any|len|map|pop|hex|f64|f32|u16|msg|i64|i16|u32|str|tos|u64|i8|u8)(?=\()"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(StrIntpCgenData|VAssertMetaInfo|StructAttribute|AttributeKind|FunctionData|StrIntpData|StrIntpType|MethodArgs|StrIntpMem|ArrayFlags|FieldData|SortedMap|ChanState|string|array|Error|map)\b"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(?<!@)(voidptr|string|error|isize|usize|i128|u128|bool|rune|int|f32|f64|i64|i16|u64|any|u32|u16|i8|u8)\b"> | ||||
|         <token type="KeywordType"/> | ||||
|       </rule> | ||||
|       <rule pattern="\bit\b"> | ||||
|         <token type="NameVariableMagic"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<!fn\s+)(?<=\w+\s+|^)\[(?=:if +)?(?=\w+)"> | ||||
|         <token type="Punctuation"/> | ||||
|         <push state="attribute"/> | ||||
|       </rule> | ||||
|       <rule pattern="(<<=|>>=|>>>=|>>>|<<|>>|<=|>=|\^=|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|\.\.|[+\-*/%&|^~=#@!])"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="[\d_]+(\.\d+e[+\-]?\d+|\.\d+|e[+\-]?\d+)"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="\.\d+(e[+\-]?\d+)?"> | ||||
|         <token type="LiteralNumberFloat"/> | ||||
|       </rule> | ||||
|       <rule pattern="0o[0-7_]+"> | ||||
|         <token type="LiteralNumberOct"/> | ||||
|       </rule> | ||||
|       <rule pattern="0x[0-9a-fA-F_]+"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="0b[01_]+"> | ||||
|         <token type="LiteralNumberBin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(0|[1-9][0-9_]*)"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern="`"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|         <push state="char"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="strings"/> | ||||
|       </rule> | ||||
|       <rule pattern="@?[A-Z]\w*"> | ||||
|         <token type="NameClass"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=[^\W\d]\w*)(<)([A-Z]\w*)(>)"> | ||||
|         <bygroups> | ||||
|           <token type="Punctuation"/> | ||||
|           <token type="NameClass"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="@?[^\W\d]\w*(?=\()"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=fn\s+)@?[^\W\d]\w*(?=\s*\()"> | ||||
|         <token type="NameFunction"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=(?:continue|break|goto)\s+)\w+"> | ||||
|         <token type="NameLabel"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b[^\W\d]\w*(?=:(?:$|\s+for))"> | ||||
|         <token type="NameLabel"/> | ||||
|       </rule> | ||||
|       <rule pattern="[<>()\[\]{}.,;:]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="@?[^\W\d]\w*"> | ||||
|         <token type="NameVariable"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="strings"> | ||||
|       <rule pattern="(c)?(")"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralStringDouble"/> | ||||
|         </bygroups> | ||||
|         <push state="string-double"/> | ||||
|       </rule> | ||||
|       <rule pattern="(c)?(')"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralStringSingle"/> | ||||
|         </bygroups> | ||||
|         <push state="string-single"/> | ||||
|       </rule> | ||||
|       <rule pattern="(r)("[^"]+")"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="(r)('[^']+')"> | ||||
|         <bygroups> | ||||
|           <token type="LiteralStringAffix"/> | ||||
|           <token type="LiteralString"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="string-single"> | ||||
|       <rule pattern="'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|       <rule> | ||||
|         <include state="char-escape"/> | ||||
|       </rule> | ||||
|       <rule pattern="(\$)((?!\\){)"> | ||||
|         <bygroups> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Punctuation"/> | ||||
|         </bygroups> | ||||
|         <push state="string-curly-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="\$"> | ||||
|         <token type="Operator"/> | ||||
|         <push state="string-interpolation"/> | ||||
|       </rule> | ||||
|       <rule pattern="[^']+?"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="char-escape"> | ||||
|       <rule pattern="\\[`'"\\abfnrtv$]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}"> | ||||
|         <token type="LiteralStringEscape"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
							
								
								
									
										85
									
								
								lexers/embedded/viml.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								lexers/embedded/viml.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>VimL</name> | ||||
|     <alias>vim</alias> | ||||
|     <filename>*.vim</filename> | ||||
|     <filename>.vimrc</filename> | ||||
|     <filename>.exrc</filename> | ||||
|     <filename>.gvimrc</filename> | ||||
|     <filename>_vimrc</filename> | ||||
|     <filename>_exrc</filename> | ||||
|     <filename>_gvimrc</filename> | ||||
|     <filename>vimrc</filename> | ||||
|     <filename>gvimrc</filename> | ||||
|     <mime_type>text/x-vim</mime_type> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern="^([ \t:]*)(py(?:t(?:h(?:o(?:n)?)?)?)?)([ \t]*)(<<)([ \t]*)(.*)((?:\n|.)*)(\6)"> | ||||
|         <bygroups> | ||||
|           <usingself state="root"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Operator"/> | ||||
|           <token type="Text"/> | ||||
|           <token type="Text"/> | ||||
|           <using lexer="Python"/> | ||||
|           <token type="Text"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^([ \t:]*)(py(?:t(?:h(?:o(?:n)?)?)?)?)([ \t])(.*)"> | ||||
|         <bygroups> | ||||
|           <usingself state="root"/> | ||||
|           <token type="Keyword"/> | ||||
|           <token type="Text"/> | ||||
|           <using lexer="Python"/> | ||||
|         </bygroups> | ||||
|       </rule> | ||||
|       <rule pattern="^\s*".*"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="[ \t]+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="/(\\\\|\\/|[^\n/])*/"> | ||||
|         <token type="LiteralStringRegex"/> | ||||
|       </rule> | ||||
|       <rule pattern=""(\\\\|\\"|[^\n"])*""> | ||||
|         <token type="LiteralStringDouble"/> | ||||
|       </rule> | ||||
|       <rule pattern="'(''|[^\n'])*'"> | ||||
|         <token type="LiteralStringSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="(?<=\s)"[^\-:.%#=*].*"> | ||||
|         <token type="Comment"/> | ||||
|       </rule> | ||||
|       <rule pattern="-?\d+"> | ||||
|         <token type="LiteralNumber"/> | ||||
|       </rule> | ||||
|       <rule pattern="#[0-9a-f]{6}"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="^:"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="[()<>+=!|,~-]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(let|if|else|endif|elseif|fun|function|endfunction|set|map|autocmd|filetype|hi(ghlight)?|execute|syntax|colorscheme)\b"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b(NONE|bold|italic|underline|dark|light)\b"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="\b\w+\b"> | ||||
|         <token type="NameOther"/> | ||||
|       </rule> | ||||
|       <rule pattern="\n"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="."> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,36 +0,0 @@ | ||||
|  | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Z80 Assembly</name> | ||||
|     <alias>z80</alias> | ||||
|     <filename>*.z80</filename> | ||||
|     <filename>*.asm</filename> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="root"> | ||||
|       <rule pattern=";.*?$"><token type="CommentSingle"/></rule> | ||||
|       <rule pattern="^[.\w]+:"><token type="NameLabel"/></rule> | ||||
|       <rule pattern="((0x)|\$)[0-9a-fA-F]+"><token type="LiteralNumberHex"/></rule> | ||||
|       <rule pattern="[0-9][0-9a-fA-F]+h"><token type="LiteralNumberHex"/></rule> | ||||
|       <rule pattern="((0b)|%)[01]+"><token type="LiteralNumberBin"/></rule> | ||||
|       <rule pattern="-?[0-9]+"><token type="LiteralNumberInteger"/></rule> | ||||
|       <rule pattern="""><token type="LiteralString"/><push state="string"/></rule> | ||||
|       <rule pattern="'\\?.'"><token type="LiteralStringChar"/></rule> | ||||
|       <rule pattern="[,=()\\]"><token type="Punctuation"/></rule> | ||||
|       <rule pattern="^\s*#\w+"><token type="CommentPreproc"/></rule> | ||||
|       <rule pattern="\.(db|dw|end|org|byte|word|fill|block|addinstr|echo|error|list|nolist|equ|show|option|seek)"><token type="NameBuiltin"/></rule> | ||||
|       <rule pattern="(ex|exx|ld|ldd|lddr|ldi|ldir|pop|push|adc|add|cp|cpd|cpdr|cpi|cpir|cpl|daa|dec|inc|neg|sbc|sub|and|bit|ccf|or|res|scf|set|xor|rl|rla|rlc|rlca|rld|rr|rra|rrc|rrca|rrd|sla|sra|srl|call|djnz|jp|jr|ret|rst|nop|reti|retn|di|ei|halt|im|in|ind|indr|ini|inir|out|outd|otdr|outi|otir)"><token type="Keyword"/></rule> | ||||
|       <rule pattern="(z|nz|c|nc|po|pe|p|m)"><token type="Keyword"/></rule> | ||||
|       <rule pattern="[+-/*~\^&|]"><token type="Operator"/></rule> | ||||
|       <rule pattern="\w+"><token type="Text"/></rule> | ||||
|       <rule pattern="\s+"><token type="Text"/></rule> | ||||
|     </state> | ||||
|     <state name="string"> | ||||
|       <rule pattern="[^"\\]+"><token type="LiteralString"/></rule> | ||||
|       <rule pattern="\\."><token type="LiteralStringEscape"/></rule> | ||||
|       <rule pattern="""><token type="LiteralString"/><pop depth="1"/></rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
|  | ||||
							
								
								
									
										74
									
								
								lexers/embedded/z80_assembly.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								lexers/embedded/z80_assembly.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| <lexer> | ||||
|   <config> | ||||
|     <name>Z80 Assembly</name> | ||||
|     <alias>z80</alias> | ||||
|     <filename>*.z80</filename> | ||||
|     <filename>*.asm</filename> | ||||
|     <case_insensitive>true</case_insensitive> | ||||
|   </config> | ||||
|   <rules> | ||||
|     <state name="string"> | ||||
|       <rule pattern="[^"\\]+"> | ||||
|         <token type="LiteralString"/> | ||||
|       </rule> | ||||
|       <rule pattern="\\."> | ||||
|         <token type="LiteralStringEscape"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralString"/> | ||||
|         <pop depth="1"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|     <state name="root"> | ||||
|       <rule pattern=";.*?$"> | ||||
|         <token type="CommentSingle"/> | ||||
|       </rule> | ||||
|       <rule pattern="^[.\w]+:"> | ||||
|         <token type="NameLabel"/> | ||||
|       </rule> | ||||
|       <rule pattern="((0x)|\$)[0-9a-fA-F]+"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="[0-9][0-9a-fA-F]+h"> | ||||
|         <token type="LiteralNumberHex"/> | ||||
|       </rule> | ||||
|       <rule pattern="((0b)|%)[01]+"> | ||||
|         <token type="LiteralNumberBin"/> | ||||
|       </rule> | ||||
|       <rule pattern="-?[0-9]+"> | ||||
|         <token type="LiteralNumberInteger"/> | ||||
|       </rule> | ||||
|       <rule pattern="""> | ||||
|         <token type="LiteralString"/> | ||||
|         <push state="string"/> | ||||
|       </rule> | ||||
|       <rule pattern="'\\?.'"> | ||||
|         <token type="LiteralStringChar"/> | ||||
|       </rule> | ||||
|       <rule pattern="[,=()\\]"> | ||||
|         <token type="Punctuation"/> | ||||
|       </rule> | ||||
|       <rule pattern="^\s*#\w+"> | ||||
|         <token type="CommentPreproc"/> | ||||
|       </rule> | ||||
|       <rule pattern="\.(db|dw|end|org|byte|word|fill|block|addinstr|echo|error|list|nolist|equ|show|option|seek)"> | ||||
|         <token type="NameBuiltin"/> | ||||
|       </rule> | ||||
|       <rule pattern="(ex|exx|ld|ldd|lddr|ldi|ldir|pop|push|adc|add|cp|cpd|cpdr|cpi|cpir|cpl|daa|dec|inc|neg|sbc|sub|and|bit|ccf|or|res|scf|set|xor|rl|rla|rlc|rlca|rld|rr|rra|rrc|rrca|rrd|sla|sra|srl|call|djnz|jp|jr|ret|rst|nop|reti|retn|di|ei|halt|im|in|ind|indr|ini|inir|out|outd|otdr|outi|otir)"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="(z|nz|c|nc|po|pe|p|m)"> | ||||
|         <token type="Keyword"/> | ||||
|       </rule> | ||||
|       <rule pattern="[+-/*~\^&|]"> | ||||
|         <token type="Operator"/> | ||||
|       </rule> | ||||
|       <rule pattern="\w+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|       <rule pattern="\s+"> | ||||
|         <token type="Text"/> | ||||
|       </rule> | ||||
|     </state> | ||||
|   </rules> | ||||
| </lexer> | ||||
| @@ -1,38 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // FortranFixed lexer. | ||||
| var FortranFixed = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:            "FortranFixed", | ||||
| 		Aliases:         []string{"fortranfixed"}, | ||||
| 		Filenames:       []string{"*.f", "*.F"}, | ||||
| 		MimeTypes:       []string{"text/x-fortran"}, | ||||
| 		NotMultiline:    true, | ||||
| 		CaseInsensitive: true, | ||||
| 	}, | ||||
| 	func() Rules { | ||||
| 		return Rules{ | ||||
| 			"root": { | ||||
| 				{`[C*].*\n`, Comment, nil}, | ||||
| 				{`#.*\n`, CommentPreproc, nil}, | ||||
| 				{` {0,4}!.*\n`, Comment, nil}, | ||||
| 				{`(.{5})`, NameLabel, Push("cont-char")}, | ||||
| 				{`.*\n`, Using("Fortran"), nil}, | ||||
| 			}, | ||||
| 			"cont-char": { | ||||
| 				{` `, TextWhitespace, Push("code")}, | ||||
| 				{`.`, GenericStrong, Push("code")}, | ||||
| 			}, | ||||
| 			"code": { | ||||
| 				{`(.{66})(.*)(\n)`, ByGroups(Using("Fortran"), Comment, TextWhitespace), Push("root")}, | ||||
| 				{`(.*)(!.*)(\n)`, ByGroups(Using("Fortran"), Comment, TextWhitespace), Push("root")}, | ||||
| 				{`(.*)(\n)`, ByGroups(Using("Fortran"), TextWhitespace), Push("root")}, | ||||
| 				Default(Push("root")), | ||||
| 			}, | ||||
| 		} | ||||
| 	}, | ||||
| )) | ||||
| @@ -1,60 +1,8 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| 	"github.com/alecthomas/chroma/v2" | ||||
| ) | ||||
|  | ||||
| // HTML lexer. | ||||
| var HTML = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:            "HTML", | ||||
| 		Aliases:         []string{"html"}, | ||||
| 		Filenames:       []string{"*.html", "*.htm", "*.xhtml", "*.xslt"}, | ||||
| 		MimeTypes:       []string{"text/html", "application/xhtml+xml"}, | ||||
| 		NotMultiline:    true, | ||||
| 		DotAll:          true, | ||||
| 		CaseInsensitive: true, | ||||
| 	}, | ||||
| 	htmlRules, | ||||
| )) | ||||
|  | ||||
| func htmlRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`[^<&]+`, Text, nil}, | ||||
| 			{`&\S*?;`, NameEntity, nil}, | ||||
| 			{`\<\!\[CDATA\[.*?\]\]\>`, CommentPreproc, nil}, | ||||
| 			{`<!--`, Comment, Push("comment")}, | ||||
| 			{`<\?.*?\?>`, CommentPreproc, nil}, | ||||
| 			{`<![^>]*>`, CommentPreproc, nil}, | ||||
| 			{`(<)(\s*)(script)(\s*)`, ByGroups(Punctuation, Text, NameTag, Text), Push("script-content", "tag")}, | ||||
| 			{`(<)(\s*)(style)(\s*)`, ByGroups(Punctuation, Text, NameTag, Text), Push("style-content", "tag")}, | ||||
| 			{`(<)(\s*)([\w:.-]+)`, ByGroups(Punctuation, Text, NameTag), Push("tag")}, | ||||
| 			{`(<)(\s*)(/)(\s*)([\w:.-]+)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), nil}, | ||||
| 		}, | ||||
| 		"comment": { | ||||
| 			{`[^-]+`, Comment, nil}, | ||||
| 			{`-->`, Comment, Pop(1)}, | ||||
| 			{`-`, Comment, nil}, | ||||
| 		}, | ||||
| 		"tag": { | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`([\w:-]+\s*)(=)(\s*)`, ByGroups(NameAttribute, Operator, Text), Push("attr")}, | ||||
| 			{`[\w:-]+`, NameAttribute, nil}, | ||||
| 			{`(/?)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation), Pop(1)}, | ||||
| 		}, | ||||
| 		"script-content": { | ||||
| 			{`(<)(\s*)(/)(\s*)(script)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)}, | ||||
| 			{`.+?(?=<\s*/\s*script\s*>)`, Using("Javascript"), nil}, | ||||
| 		}, | ||||
| 		"style-content": { | ||||
| 			{`(<)(\s*)(/)(\s*)(style)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)}, | ||||
| 			{`.+?(?=<\s*/\s*style\s*>)`, Using("CSS"), nil}, | ||||
| 		}, | ||||
| 		"attr": { | ||||
| 			{`".*?"`, LiteralString, Pop(1)}, | ||||
| 			{`'.*?'`, LiteralString, Pop(1)}, | ||||
| 			{`[^\s>]+`, LiteralString, Pop(1)}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| var HTML = chroma.MustNewXMLLexer(embedded, "embedded/html.xml") | ||||
|   | ||||
| @@ -1,56 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Makefile lexer. | ||||
| var Makefile = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Makefile", | ||||
| 		Aliases:   []string{"make", "makefile", "mf", "bsdmake"}, | ||||
| 		Filenames: []string{"*.mak", "*.mk", "Makefile", "makefile", "Makefile.*", "GNUmakefile", "BSDmakefile"}, | ||||
| 		MimeTypes: []string{"text/x-makefile"}, | ||||
| 		EnsureNL:  true, | ||||
| 	}, | ||||
| 	makefileRules, | ||||
| )) | ||||
|  | ||||
| func makefileRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`^(?:[\t ]+.*\n|\n)+`, Using("Bash"), nil}, | ||||
| 			{`\$[<@$+%?|*]`, Keyword, nil}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`#.*?\n`, Comment, nil}, | ||||
| 			{`(export)(\s+)(?=[\w${}\t -]+\n)`, ByGroups(Keyword, Text), Push("export")}, | ||||
| 			{`export\s+`, Keyword, nil}, | ||||
| 			{`([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)`, ByGroups(NameVariable, Text, Operator, Text, Using("Bash")), nil}, | ||||
| 			{`(?s)"(\\\\|\\.|[^"\\])*"`, LiteralStringDouble, nil}, | ||||
| 			{`(?s)'(\\\\|\\.|[^'\\])*'`, LiteralStringSingle, nil}, | ||||
| 			{`([^\n:]+)(:+)([ \t]*)`, ByGroups(NameFunction, Operator, Text), Push("block-header")}, | ||||
| 			{`\$\(`, Keyword, Push("expansion")}, | ||||
| 		}, | ||||
| 		"expansion": { | ||||
| 			{`[^$a-zA-Z_()]+`, Text, nil}, | ||||
| 			{`[a-zA-Z_]+`, NameVariable, nil}, | ||||
| 			{`\$`, Keyword, nil}, | ||||
| 			{`\(`, Keyword, Push()}, | ||||
| 			{`\)`, Keyword, Pop(1)}, | ||||
| 		}, | ||||
| 		"export": { | ||||
| 			{`[\w${}-]+`, NameVariable, nil}, | ||||
| 			{`\n`, Text, Pop(1)}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 		}, | ||||
| 		"block-header": { | ||||
| 			{`[,|]`, Punctuation, nil}, | ||||
| 			{`#.*?\n`, Comment, Pop(1)}, | ||||
| 			{`\\\n`, Text, nil}, | ||||
| 			{`\$\(`, Keyword, Push("expansion")}, | ||||
| 			{`[a-zA-Z_]+`, Name, nil}, | ||||
| 			{`\n`, Text, Pop(1)}, | ||||
| 			{`.`, Text, nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,62 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Mako lexer. | ||||
| var Mako = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Mako", | ||||
| 		Aliases:   []string{"mako"}, | ||||
| 		Filenames: []string{"*.mao"}, | ||||
| 		MimeTypes: []string{"application/x-mako"}, | ||||
| 	}, | ||||
| 	makoRules, | ||||
| )) | ||||
|  | ||||
| func makoRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`(\s*)(%)(\s*end(?:\w+))(\n|\Z)`, ByGroups(Text, CommentPreproc, Keyword, Other), nil}, | ||||
| 			{`(\s*)(%)([^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Using("Python"), Other), nil}, | ||||
| 			{`(\s*)(##[^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Other), nil}, | ||||
| 			{`(?s)<%doc>.*?</%doc>`, CommentPreproc, nil}, | ||||
| 			{`(<%)([\w.:]+)`, ByGroups(CommentPreproc, NameBuiltin), Push("tag")}, | ||||
| 			{`(</%)([\w.:]+)(>)`, ByGroups(CommentPreproc, NameBuiltin, CommentPreproc), nil}, | ||||
| 			{`<%(?=([\w.:]+))`, CommentPreproc, Push("ondeftags")}, | ||||
| 			{`(<%(?:!?))(.*?)(%>)(?s)`, ByGroups(CommentPreproc, Using("Python"), CommentPreproc), nil}, | ||||
| 			{`(\$\{)(.*?)(\})`, ByGroups(CommentPreproc, Using("Python"), CommentPreproc), nil}, | ||||
| 			{`(?sx) | ||||
|                 (.+?)                # anything, followed by: | ||||
|                 (?: | ||||
|                  (?<=\n)(?=%|\#\#) | # an eval or comment line | ||||
|                  (?=\#\*) |          # multiline comment | ||||
|                  (?=</?%) |          # a python block | ||||
|                                      # call start or end | ||||
|                  (?=\$\{) |          # a substitution | ||||
|                  (?<=\n)(?=\s*%) | | ||||
|                                      # - don't consume | ||||
|                  (\\\n) |            # an escaped newline | ||||
|                  \Z                  # end of string | ||||
|                 ) | ||||
|             `, ByGroups(Other, Operator), nil}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 		}, | ||||
| 		"ondeftags": { | ||||
| 			{`<%`, CommentPreproc, nil}, | ||||
| 			{`(?<=<%)(include|inherit|namespace|page)`, NameBuiltin, nil}, | ||||
| 			Include("tag"), | ||||
| 		}, | ||||
| 		"tag": { | ||||
| 			{`((?:\w+)\s*=)(\s*)(".*?")`, ByGroups(NameAttribute, Text, LiteralString), nil}, | ||||
| 			{`/?\s*>`, CommentPreproc, Pop(1)}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 		}, | ||||
| 		"attr": { | ||||
| 			{`".*?"`, LiteralString, Pop(1)}, | ||||
| 			{`'.*?'`, LiteralString, Pop(1)}, | ||||
| 			{`[^\s>]+`, LiteralString, Pop(1)}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,44 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Mason lexer. | ||||
| var Mason = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Mason", | ||||
| 		Aliases:   []string{"mason"}, | ||||
| 		Filenames: []string{"*.m", "*.mhtml", "*.mc", "*.mi", "autohandler", "dhandler"}, | ||||
| 		MimeTypes: []string{"application/x-mason"}, | ||||
| 		Priority:  0.1, | ||||
| 	}, | ||||
| 	masonRules, | ||||
| )) | ||||
|  | ||||
| func masonRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`(<%doc>)(.*?)(</%doc>)(?s)`, ByGroups(NameTag, CommentMultiline, NameTag), nil}, | ||||
| 			{`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil}, | ||||
| 			{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using("Perl"), NameTag), nil}, | ||||
| 			{`(<&[^|])(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using("Perl"), NameTag), nil}, | ||||
| 			{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using("Perl"), NameTag), nil}, | ||||
| 			{`</&>`, NameTag, nil}, | ||||
| 			{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using("Perl"), NameTag), nil}, | ||||
| 			{`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil}, | ||||
| 			{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using("Perl"), Other), nil}, | ||||
| 			{`(?sx) | ||||
|                  (.+?)               # anything, followed by: | ||||
|                  (?: | ||||
|                   (?<=\n)(?=[%#]) |  # an eval or comment line | ||||
|                   (?=</?[%&]) |      # a substitution or block or | ||||
|                                      # call start or end | ||||
|                                      # - don't consume | ||||
|                   (\\\n) |           # an escaped newline | ||||
|                   \Z                 # end of string | ||||
|                  )`, ByGroups(Using("HTML"), Operator), nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,42 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Myghty lexer. | ||||
| var Myghty = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Myghty", | ||||
| 		Aliases:   []string{"myghty"}, | ||||
| 		Filenames: []string{"*.myt", "autodelegate"}, | ||||
| 		MimeTypes: []string{"application/x-myghty"}, | ||||
| 	}, | ||||
| 	myghtyRules, | ||||
| )) | ||||
|  | ||||
| func myghtyRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil}, | ||||
| 			{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using("Python2"), NameTag), nil}, | ||||
| 			{`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using("Python2"), NameTag), nil}, | ||||
| 			{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using("Python2"), NameTag), nil}, | ||||
| 			{`</&>`, NameTag, nil}, | ||||
| 			{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using("Python2"), NameTag), nil}, | ||||
| 			{`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil}, | ||||
| 			{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using("Python2"), Other), nil}, | ||||
| 			{`(?sx) | ||||
|                  (.+?)               # anything, followed by: | ||||
|                  (?: | ||||
|                   (?<=\n)(?=[%#]) |  # an eval or comment line | ||||
|                   (?=</?[%&]) |      # a substitution or block or | ||||
|                                      # call start or end | ||||
|                                      # - don't consume | ||||
|                   (\\\n) |           # an escaped newline | ||||
|                   \Z                 # end of string | ||||
|                  )`, ByGroups(Other, Operator), nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,99 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Org mode lexer. | ||||
| var Org = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Org Mode", | ||||
| 		Aliases:   []string{"org", "orgmode"}, | ||||
| 		Filenames: []string{"*.org"}, | ||||
| 		MimeTypes: []string{"text/org"}, // https://lists.gnu.org/r/emacs-orgmode/2017-09/msg00087.html | ||||
| 	}, | ||||
| 	orgRules, | ||||
| )) | ||||
|  | ||||
| func orgRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`^# .*$`, Comment, nil}, | ||||
| 			// Headings | ||||
| 			{`^(\*)( COMMENT)( .*)$`, ByGroups(GenericHeading, NameEntity, GenericStrong), nil}, | ||||
| 			{`^(\*\*+)( COMMENT)( .*)$`, ByGroups(GenericSubheading, NameEntity, Text), nil}, | ||||
| 			{`^(\*)( DONE)( .*)$`, ByGroups(GenericHeading, LiteralStringRegex, GenericStrong), nil}, | ||||
| 			{`^(\*\*+)( DONE)( .*)$`, ByGroups(GenericSubheading, LiteralStringRegex, Text), nil}, | ||||
| 			{`^(\*)( TODO)( .*)$`, ByGroups(GenericHeading, Error, GenericStrong), nil}, | ||||
| 			{`^(\*\*+)( TODO)( .*)$`, ByGroups(GenericSubheading, Error, Text), nil}, | ||||
| 			{`^(\*)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericHeading, GenericStrong, GenericEmph), nil}, // Level 1 heading with tags | ||||
| 			{`^(\*)( .+)$`, ByGroups(GenericHeading, GenericStrong), nil},                                   // // Level 1 heading with NO tags | ||||
| 			{`^(\*\*+)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericSubheading, Text, GenericEmph), nil},    // Level 2+ heading with tags | ||||
| 			{`^(\*\*+)( .+)$`, ByGroups(GenericSubheading, Text), nil},                                      // Level 2+ heading with NO tags | ||||
| 			// Checkbox lists | ||||
| 			{`^( *)([+-] )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, | ||||
| 			{`^( +)(\* )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, | ||||
| 			// Definition lists | ||||
| 			{`^( *)([+-] )([^ \n]+ ::)( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, | ||||
| 			{`^( +)(\* )([^ \n]+ ::)( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil}, | ||||
| 			// Unordered lists | ||||
| 			{`^( *)([+-] )(.+)$`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, | ||||
| 			{`^( +)(\* )(.+)$`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, | ||||
| 			// Ordered lists | ||||
| 			{`^( *)([0-9]+[.)])( \[@[0-9]+\])( .+)$`, ByGroups(Text, Keyword, GenericEmph, UsingSelf("inline")), nil}, | ||||
| 			{`^( *)([0-9]+[.)])( .+)$`, ByGroups(Text, Keyword, UsingSelf("inline")), nil}, | ||||
| 			// Dynamic Blocks | ||||
| 			{`(?i)^( *#\+begin: )([^ ]+)([\w\W]*?\n)([\w\W]*?)(^ *#\+end: *$)`, ByGroups(Comment, CommentSpecial, Comment, UsingSelf("inline"), Comment), nil}, | ||||
| 			// Blocks | ||||
| 			// - Comment Blocks | ||||
| 			{`(?i)^( *#\+begin_comment *\n)([\w\W]*?)(^ *#\+end_comment *$)`, ByGroups(Comment, Comment, Comment), nil}, | ||||
| 			// - Src Blocks | ||||
| 			{ | ||||
| 				`(?i)^( *#\+begin_src )([^ \n]+)(.*?\n)([\w\W]*?)(^ *#\+end_src *$)`, | ||||
| 				UsingByGroup(2, 4, Comment, CommentSpecial, Comment, Text, Comment), | ||||
| 				nil, | ||||
| 			}, | ||||
| 			// - Export Blocks | ||||
| 			{ | ||||
| 				`(?i)^( *#\+begin_export )(\w+)( *\n)([\w\W]*?)(^ *#\+end_export *$)`, | ||||
| 				UsingByGroup(2, 4, Comment, CommentSpecial, Text, Text, Comment), | ||||
| 				nil, | ||||
| 			}, | ||||
| 			// - Org Special, Example, Verse, etc. Blocks | ||||
| 			{`(?i)^( *#\+begin_)(\w+)( *\n)([\w\W]*?)(^ *#\+end_\2)( *$)`, ByGroups(Comment, Comment, Text, Text, Comment, Text), nil}, | ||||
| 			// Keywords | ||||
| 			{`^(#\+\w+)(:.*)$`, ByGroups(CommentSpecial, Comment), nil}, // Other Org keywords like #+title | ||||
| 			// Properties and Drawers | ||||
| 			{`(?i)^( *:\w+: *\n)([\w\W]*?)(^ *:end: *$)`, ByGroups(Comment, CommentSpecial, Comment), nil}, | ||||
| 			// Line break operator | ||||
| 			{`^(.*)(\\\\)$`, ByGroups(UsingSelf("inline"), Operator), nil}, | ||||
| 			// Deadline/Scheduled | ||||
| 			{`(?i)^( *(?:DEADLINE|SCHEDULED): )(<[^<>]+?> *)$`, ByGroups(Comment, CommentSpecial), nil}, // DEADLINE/SCHEDULED: <datestamp> | ||||
| 			// DONE state CLOSED | ||||
| 			{`(?i)^( *CLOSED: )(\[[^][]+?\] *)$`, ByGroups(Comment, CommentSpecial), nil}, // CLOSED: [datestamp] | ||||
| 			// All other lines | ||||
| 			Include("inline"), | ||||
| 		}, | ||||
| 		"inline": { | ||||
| 			{`(\s)*(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))`, ByGroups(Text, GenericStrong, Text), nil},                          // Bold | ||||
| 			{`(\s)*(/[^/]+?/)((?=\W|\n|$))`, ByGroups(Text, GenericEmph, Text), nil},                                            // Italic | ||||
| 			{`(\s)*(=[^\n=]+?=)((?=\W|\n|$))`, ByGroups(Text, NameClass, Text), nil},                                            // Verbatim | ||||
| 			{`(\s)*(~[^\n~]+?~)((?=\W|\n|$))`, ByGroups(Text, NameClass, Text), nil},                                            // Code | ||||
| 			{`(\s)*(\+[^+]+?\+)((?=\W|\n|$))`, ByGroups(Text, GenericDeleted, Text), nil},                                       // Strikethrough | ||||
| 			{`(\s)*(_[^_]+?_)((?=\W|\n|$))`, ByGroups(Text, GenericUnderline, Text), nil},                                       // Underline | ||||
| 			{`(<)([^<>]+?)(>)`, ByGroups(Text, String, Text), nil},                                                              // <datestamp> | ||||
| 			{`[{]{3}[^}]+[}]{3}`, NameBuiltin, nil},                                                                             // {{{macro(foo,1)}}} | ||||
| 			{`([^[])(\[fn:)([^]]+?)(\])([^]])`, ByGroups(Text, NameBuiltinPseudo, LiteralString, NameBuiltinPseudo, Text), nil}, // [fn:1] | ||||
| 			// Links | ||||
| 			{`(\[\[)([^][]+?)(\]\[)([^][]+)(\]\])`, ByGroups(Text, NameAttribute, Text, NameTag, Text), nil}, // [[link][descr]] | ||||
| 			{`(\[\[)([^][]+?)(\]\])`, ByGroups(Text, NameAttribute, Text), nil},                              // [[link]] | ||||
| 			{`(<<)([^<>]+?)(>>)`, ByGroups(Text, NameAttribute, Text), nil},                                  // <<targetlink>> | ||||
| 			// Tables | ||||
| 			{`^( *)(\|[ -].*?[ -]\|)$`, ByGroups(Text, String), nil}, | ||||
| 			// Blank lines, newlines | ||||
| 			{`\n`, Text, nil}, | ||||
| 			// Any other text | ||||
| 			{`.`, Text, nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,16 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| var Plaintext = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "plaintext", | ||||
| 		Aliases:   []string{"text", "plain", "no-highlight"}, | ||||
| 		Filenames: []string{"*.txt"}, | ||||
| 		MimeTypes: []string{"text/plain"}, | ||||
| 		Priority:  -1, | ||||
| 	}, | ||||
| 	PlaintextRules, | ||||
| )) | ||||
| @@ -1,77 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Postgresql Sql Dialect lexer. | ||||
| var PostgreSQL = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:            "PostgreSQL SQL dialect", | ||||
| 		Aliases:         []string{"postgresql", "postgres"}, | ||||
| 		Filenames:       []string{}, | ||||
| 		MimeTypes:       []string{"text/x-postgresql"}, | ||||
| 		NotMultiline:    true, | ||||
| 		CaseInsensitive: true, | ||||
| 	}, | ||||
| 	postgreSQLRules, | ||||
| )) | ||||
|  | ||||
| func postgreSQLRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`--.*\n?`, CommentSingle, nil}, | ||||
| 			{`/\*`, CommentMultiline, Push("multiline-comments")}, | ||||
| 			{`(bigint|bigserial|bit|bit\s+varying|bool|boolean|box|bytea|char|character|character\s+varying|cidr|circle|date|decimal|double\s+precision|float4|float8|inet|int|int2|int4|int8|integer|interval|json|jsonb|line|lseg|macaddr|money|numeric|path|pg_lsn|point|polygon|real|serial|serial2|serial4|serial8|smallint|smallserial|text|time|timestamp|timestamptz|timetz|tsquery|tsvector|txid_snapshot|uuid|varbit|varchar|with\s+time\s+zone|without\s+time\s+zone|xml|anyarray|anyelement|anyenum|anynonarray|anyrange|cstring|fdw_handler|internal|language_handler|opaque|record|void)\b`, NameBuiltin, nil}, | ||||
| 			{ | ||||
| 				`(?s)(DO)(\s+)(?:(LANGUAGE)?(\s+)('?)(\w+)?('?)(\s+))?(\$)([^$]*)(\$)(.*?)(\$)(\10)(\$)`, | ||||
| 				UsingByGroup(6, 12, | ||||
| 					Keyword, Text, Keyword, Text, // DO LANGUAGE | ||||
| 					StringSingle, StringSingle, StringSingle, Text, // 'plpgsql' | ||||
| 					StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ | ||||
| 					StringHeredoc,                                // (code block) | ||||
| 					StringHeredoc, StringHeredoc, StringHeredoc), // $tag$ | ||||
| 				nil, | ||||
| 			}, | ||||
| 			{Words(``, `\b`, `ABORT`, `ABSOLUTE`, `ACCESS`, `ACTION`, `ADD`, `ADMIN`, `AFTER`, `AGGREGATE`, `ALL`, `ALSO`, `ALTER`, `ALWAYS`, `ANALYSE`, `ANALYZE`, `AND`, `ANY`, `ARRAY`, `AS`, `ASC`, `ASSERTION`, `ASSIGNMENT`, `ASYMMETRIC`, `AT`, `ATTRIBUTE`, `AUTHORIZATION`, `BACKWARD`, `BEFORE`, `BEGIN`, `BETWEEN`, `BIGINT`, `BINARY`, `BIT`, `BOOLEAN`, `BOTH`, `BY`, `CACHE`, `CALLED`, `CASCADE`, `CASCADED`, `CASE`, `CAST`, `CATALOG`, `CHAIN`, `CHAR`, `CHARACTER`, `CHARACTERISTICS`, `CHECK`, `CHECKPOINT`, `CLASS`, `CLOSE`, `CLUSTER`, `COALESCE`, `COLLATE`, `COLLATION`, `COLUMN`, `COMMENT`, `COMMENTS`, `COMMIT`, `COMMITTED`, `CONCURRENTLY`, `CONFIGURATION`, `CONNECTION`, `CONSTRAINT`, `CONSTRAINTS`, `CONTENT`, `CONTINUE`, `CONVERSION`, `COPY`, `COST`, `CREATE`, `CROSS`, `CSV`, `CURRENT`, `CURRENT_CATALOG`, `CURRENT_DATE`, `CURRENT_ROLE`, `CURRENT_SCHEMA`, `CURRENT_TIME`, `CURRENT_TIMESTAMP`, `CURRENT_USER`, `CURSOR`, `CYCLE`, `DATA`, `DATABASE`, `DAY`, `DEALLOCATE`, `DEC`, `DECIMAL`, `DECLARE`, `DEFAULT`, `DEFAULTS`, `DEFERRABLE`, `DEFERRED`, `DEFINER`, `DELETE`, `DELIMITER`, `DELIMITERS`, `DESC`, `DICTIONARY`, `DISABLE`, `DISCARD`, `DISTINCT`, `DO`, `DOCUMENT`, `DOMAIN`, `DOUBLE`, `DROP`, `EACH`, `ELSE`, `ENABLE`, `ENCODING`, `ENCRYPTED`, `END`, `ENUM`, `ESCAPE`, `EVENT`, `EXCEPT`, `EXCLUDE`, `EXCLUDING`, `EXCLUSIVE`, `EXECUTE`, `EXISTS`, `EXPLAIN`, `EXTENSION`, `EXTERNAL`, `EXTRACT`, `FALSE`, `FAMILY`, `FETCH`, `FILTER`, `FIRST`, `FLOAT`, `FOLLOWING`, `FOR`, `FORCE`, `FOREIGN`, `FORWARD`, `FREEZE`, `FROM`, `FULL`, `FUNCTION`, `FUNCTIONS`, `GLOBAL`, `GRANT`, `GRANTED`, `GREATEST`, `GROUP`, `HANDLER`, `HAVING`, `HEADER`, `HOLD`, `HOUR`, `IDENTITY`, `IF`, `ILIKE`, `IMMEDIATE`, `IMMUTABLE`, `IMPLICIT`, `IN`, `INCLUDING`, `INCREMENT`, `INDEX`, `INDEXES`, `INHERIT`, `INHERITS`, `INITIALLY`, `INLINE`, `INNER`, `INOUT`, `INPUT`, `INSENSITIVE`, `INSERT`, `INSTEAD`, `INT`, `INTEGER`, `INTERSECT`, `INTERVAL`, `INTO`, `INVOKER`, `IS`, `ISNULL`, `ISOLATION`, `JOIN`, `KEY`, `LABEL`, `LANGUAGE`, `LARGE`, `LAST`, `LATERAL`, `LC_COLLATE`, `LC_CTYPE`, `LEADING`, `LEAKPROOF`, `LEAST`, `LEFT`, `LEVEL`, `LIKE`, `LIMIT`, `LISTEN`, `LOAD`, `LOCAL`, `LOCALTIME`, `LOCALTIMESTAMP`, `LOCATION`, `LOCK`, `MAPPING`, `MATCH`, `MATERIALIZED`, `MAXVALUE`, `MINUTE`, `MINVALUE`, `MODE`, `MONTH`, `MOVE`, `NAME`, `NAMES`, `NATIONAL`, `NATURAL`, `NCHAR`, `NEXT`, `NO`, `NONE`, `NOT`, `NOTHING`, `NOTIFY`, `NOTNULL`, `NOWAIT`, `NULL`, `NULLIF`, `NULLS`, `NUMERIC`, `OBJECT`, `OF`, `OFF`, `OFFSET`, `OIDS`, `ON`, `ONLY`, `OPERATOR`, `OPTION`, `OPTIONS`, `OR`, `ORDER`, `ORDINALITY`, `OUT`, `OUTER`, `OVER`, `OVERLAPS`, `OVERLAY`, `OWNED`, `OWNER`, `PARSER`, `PARTIAL`, `PARTITION`, `PASSING`, `PASSWORD`, `PLACING`, `PLANS`, `POLICY`, `POSITION`, `PRECEDING`, `PRECISION`, `PREPARE`, `PREPARED`, `PRESERVE`, `PRIMARY`, `PRIOR`, `PRIVILEGES`, `PROCEDURAL`, `PROCEDURE`, `PROGRAM`, `QUOTE`, `RANGE`, `READ`, `REAL`, `REASSIGN`, `RECHECK`, `RECURSIVE`, `REF`, `REFERENCES`, `REFRESH`, `REINDEX`, `RELATIVE`, `RELEASE`, `RENAME`, `REPEATABLE`, `REPLACE`, `REPLICA`, `RESET`, `RESTART`, `RESTRICT`, `RETURNING`, `RETURNS`, `REVOKE`, `RIGHT`, `ROLE`, `ROLLBACK`, `ROW`, `ROWS`, `RULE`, `SAVEPOINT`, `SCHEMA`, `SCROLL`, `SEARCH`, `SECOND`, `SECURITY`, `SELECT`, `SEQUENCE`, `SEQUENCES`, `SERIALIZABLE`, `SERVER`, `SESSION`, `SESSION_USER`, `SET`, `SETOF`, `SHARE`, `SHOW`, `SIMILAR`, `SIMPLE`, `SMALLINT`, `SNAPSHOT`, `SOME`, `STABLE`, `STANDALONE`, `START`, `STATEMENT`, `STATISTICS`, `STDIN`, `STDOUT`, `STORAGE`, `STRICT`, `STRIP`, `SUBSTRING`, `SYMMETRIC`, `SYSID`, `SYSTEM`, `TABLE`, `TABLES`, `TABLESPACE`, `TEMP`, `TEMPLATE`, `TEMPORARY`, `TEXT`, `THEN`, `TIME`, `TIMESTAMP`, `TO`, `TRAILING`, `TRANSACTION`, `TREAT`, `TRIGGER`, `TRIM`, `TRUE`, `TRUNCATE`, `TRUSTED`, `TYPE`, `TYPES`, `UNBOUNDED`, `UNCOMMITTED`, `UNENCRYPTED`, `UNION`, `UNIQUE`, `UNKNOWN`, `UNLISTEN`, `UNLOGGED`, `UNTIL`, `UPDATE`, `USER`, `USING`, `VACUUM`, `VALID`, `VALIDATE`, `VALIDATOR`, `VALUE`, `VALUES`, `VARCHAR`, `VARIADIC`, `VARYING`, `VERBOSE`, `VERSION`, `VIEW`, `VIEWS`, `VOLATILE`, `WHEN`, `WHERE`, `WHITESPACE`, `WINDOW`, `WITH`, `WITHIN`, `WITHOUT`, `WORK`, `WRAPPER`, `WRITE`, `XML`, `XMLATTRIBUTES`, `XMLCONCAT`, `XMLELEMENT`, `XMLEXISTS`, `XMLFOREST`, `XMLPARSE`, `XMLPI`, `XMLROOT`, `XMLSERIALIZE`, `YEAR`, `YES`, `ZONE`), Keyword, nil}, | ||||
| 			{"[+*/<>=~!@#%^&|`?-]+", Operator, nil}, | ||||
| 			{`::`, Operator, nil}, | ||||
| 			{`\$\d+`, NameVariable, nil}, | ||||
| 			{`([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, | ||||
| 			{`[0-9]+`, LiteralNumberInteger, nil}, | ||||
| 			{`((?:E|U&)?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("string")}, | ||||
| 			{`((?:U&)?)(")`, ByGroups(LiteralStringAffix, LiteralStringName), Push("quoted-ident")}, | ||||
| 			{ | ||||
| 				`(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)(\s+)(LANGUAGE)?(\s+)('?)(\w+)?('?)`, | ||||
| 				UsingByGroup(12, 4, | ||||
| 					StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ | ||||
| 					StringHeredoc,                               // (code block) | ||||
| 					StringHeredoc, StringHeredoc, StringHeredoc, // $tag$ | ||||
| 					Text, Keyword, Text, // <space> LANGUAGE <space> | ||||
| 					StringSingle, StringSingle, StringSingle), // 'type' | ||||
| 				nil, | ||||
| 			}, | ||||
| 			{`(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)`, LiteralStringHeredoc, nil}, | ||||
| 			{`[a-z_]\w*`, Name, nil}, | ||||
| 			{`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil}, | ||||
| 			{`[;:()\[\]{},.]`, Punctuation, nil}, | ||||
| 		}, | ||||
| 		"multiline-comments": { | ||||
| 			{`/\*`, CommentMultiline, Push("multiline-comments")}, | ||||
| 			{`\*/`, CommentMultiline, Pop(1)}, | ||||
| 			{`[^/*]+`, CommentMultiline, nil}, | ||||
| 			{`[/*]`, CommentMultiline, nil}, | ||||
| 		}, | ||||
| 		"string": { | ||||
| 			{`[^']+`, LiteralStringSingle, nil}, | ||||
| 			{`''`, LiteralStringSingle, nil}, | ||||
| 			{`'`, LiteralStringSingle, Pop(1)}, | ||||
| 		}, | ||||
| 		"quoted-ident": { | ||||
| 			{`[^"]+`, LiteralStringName, nil}, | ||||
| 			{`""`, LiteralStringName, nil}, | ||||
| 			{`"`, LiteralStringName, Pop(1)}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -1,42 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Smarty lexer. | ||||
| var Smarty = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "Smarty", | ||||
| 		Aliases:   []string{"smarty"}, | ||||
| 		Filenames: []string{"*.tpl"}, | ||||
| 		MimeTypes: []string{"application/x-smarty"}, | ||||
| 		DotAll:    true, | ||||
| 	}, | ||||
| 	smartyRules, | ||||
| )) | ||||
|  | ||||
| func smartyRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`[^{]+`, Other, nil}, | ||||
| 			{`(\{)(\*.*?\*)(\})`, ByGroups(CommentPreproc, Comment, CommentPreproc), nil}, | ||||
| 			{`(\{php\})(.*?)(\{/php\})`, ByGroups(CommentPreproc, Using("PHP"), CommentPreproc), nil}, | ||||
| 			{`(\{)(/?[a-zA-Z_]\w*)(\s*)`, ByGroups(CommentPreproc, NameFunction, Text), Push("smarty")}, | ||||
| 			{`\{`, CommentPreproc, Push("smarty")}, | ||||
| 		}, | ||||
| 		"smarty": { | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`\{`, CommentPreproc, Push()}, | ||||
| 			{`\}`, CommentPreproc, Pop(1)}, | ||||
| 			{`#[a-zA-Z_]\w*#`, NameVariable, nil}, | ||||
| 			{`\$[a-zA-Z_]\w*(\.\w+)*`, NameVariable, nil}, | ||||
| 			{`[~!%^&*()+=|\[\]:;,.<>/?@-]`, Operator, nil}, | ||||
| 			{`(true|false|null)\b`, KeywordConstant, nil}, | ||||
| 			{`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, | ||||
| 			{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, | ||||
| 			{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, | ||||
| 			{`[a-zA-Z_]\w*`, NameAttribute, nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										3
									
								
								lexers/testdata/analysis/bash.actual
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								lexers/testdata/analysis/bash.actual
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| echo "This is a bash script" | ||||
							
								
								
									
										1
									
								
								lexers/testdata/analysis/bash.expected
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								lexers/testdata/analysis/bash.expected
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 1.0 | ||||
							
								
								
									
										173
									
								
								lexers/v.go
									
									
									
									
									
								
							
							
						
						
									
										173
									
								
								lexers/v.go
									
									
									
									
									
								
							| @@ -1,173 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // V lexer. | ||||
| var V = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "V", | ||||
| 		Aliases:   []string{"v", "vlang"}, | ||||
| 		Filenames: []string{"*.v", "*.vv", "v.mod"}, | ||||
| 		MimeTypes: []string{"text/x-v"}, | ||||
| 		EnsureNL:  true, | ||||
| 	}, | ||||
| 	vRules, | ||||
| ).SetAnalyser(func(text string) float32 { | ||||
| 	if strings.Contains(text, "import ") && strings.Contains(text, "module ") { | ||||
| 		return 0.2 | ||||
| 	} | ||||
| 	if strings.Contains(text, "module ") { | ||||
| 		return 0.1 | ||||
| 	} | ||||
| 	return 0.0 | ||||
| })) | ||||
|  | ||||
| const ( | ||||
| 	namePattern             = `[^\W\d]\w*` | ||||
| 	typeNamePattern         = `[A-Z]\w*` | ||||
| 	multiLineCommentPattern = `/\*(?:.|\n)*?\*/` | ||||
| ) | ||||
|  | ||||
| func vRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`\n`, Text, nil}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`\\\n`, Text, nil}, | ||||
| 			{`(?<=module\s+\w[^\n]*\s+)(//[^\n]+\n)+(?=\n)`, StringDoc, nil}, | ||||
| 			{`(// *)(\w+)([^\n]+\n)(?=(?://[^\n]*\n)* *(?:pub +)?(?:fn|struct|union|type|interface|enum|const) +\2\b)`, ByGroups(StringDoc, GenericEmph, StringDoc), Push(`string-doc`)}, | ||||
| 			{`//[^\n]*\n`, CommentSingle, nil}, | ||||
| 			{`/\*(?:(?:` + multiLineCommentPattern + `)*|.|\n)*\*/`, CommentMultiline, nil}, | ||||
| 			{`\b(import|module)\b`, KeywordNamespace, nil}, | ||||
| 			{`\b(fn|struct|union|map|chan|type|interface|enum|const|mut|shared|pub|__global)\b`, KeywordDeclaration, nil}, | ||||
| 			{`\?`, KeywordDeclaration, nil}, | ||||
| 			{`(?<=\)\s*)!`, KeywordDeclaration, nil}, | ||||
| 			{`[ \t]*#include[^\n]+`, Using(`c`), nil}, | ||||
| 			{`[ \t]*#\w[^\n]*`, CommentPreproc, nil}, | ||||
| 			{`(sql)(\s+)(\w+)(\s+)({)([^}]*?)(})`, ByGroups(Keyword, Text, Name, Text, Punctuation, Using(`sql`), Punctuation), nil}, | ||||
| 			{`\$(?=\w)`, Operator, nil}, | ||||
| 			{`(?<=\$)(?:embed_file|pkgconfig|tmpl|env|compile_error|compile_warn)`, NameBuiltin, nil}, | ||||
| 			{`(asm)(\s+)(\w+)(\s*)({)([^}]*?)(})`, ByGroups(Keyword, Text, KeywordType, Text, Punctuation, Using(`nasm`), Punctuation), nil}, | ||||
| 			{`\b_(?:un)?likely_(?=\()`, NameFunctionMagic, nil}, | ||||
| 			{`(?<=\$if.+?(?:&&|\|\|)?)(` + Words(``, ``, `windows`, `linux`, `macos`, `mac`, `darwin`, `ios`, `android`, `mach`, `dragonfly`, `gnu`, `hpux`, `haiku`, `qnx`, `solaris`, `gcc`, `tinyc`, `clang`, `mingw`, `msvc`, `cplusplus`, `amd64`, `arm64`, `x64`, `x32`, `little_endian`, `big_endian`, `debug`, `prod`, `test`, `js`, `glibc`, `prealloc`, `no_bounds_checking`, `freestanding`, `no_segfault_handler`, `no_backtrace`, `no_main`) + `)+`, NameBuiltin, nil}, | ||||
| 			{`@` + Words(``, `\b`, `FN`, `METHOD`, `MOD`, `STRUCT`, `FILE`, `LINE`, `COLUMN`, `VEXE`, `VEXEROOT`, `VHASH`, `VMOD_FILE`, `VMODROOT`), NameVariableMagic, nil}, | ||||
| 			{Words(`\b(?<!@)`, `\b`, `break`, `select`, `match`, `defer`, `go`, `goto`, `else`, `if`, `continue`, `for`, `return`, `assert`, `or`, `as`, `atomic`, `isreftype`, `is`, `in`, `lock`, `rlock`, `sizeof`, `typeof`, `unsafe`, `volatile`, `static`, `__offsetof`), Keyword, nil}, | ||||
| 			{`\b(?<!@)(none|true|false|si_s_code|si_g32_code|si_g64_code)\b`, KeywordConstant, nil}, | ||||
| 			{Words(`\b(?<!@)`, `(?=\()`, `u8`, `u16`, `u32`, `u64`, `u128`, `int`, `i8`, `i16`, `i64`, `i128`, `f32`, `f64`, `rune`, `string`, `bool`, `usize`, `isize`, `any`, `error`, `print`, `println`, `dump`, `panic`, `eprint`, `eprintln`, `copy`, `close`, `len`, `map`, `filter`, `cap`, `delete`, `delete_many`, `delete_last`, `c_error_number_str`, `compare_strings`, `cstring_to_vstring`, `error_with_code`, `exit`, `f32_abs`, `f32_max`, `f32_min`, `f64_max`, `flush_stderr`, `flush_stdout`, `free`, `gc_check_leaks`, `get_str_intp_u32_format`, `get_str_intp_u64_format`, `isnil`, `malloc`, `malloc_noscan`, `memdup`, `memdup_noscan`, `panic_error_number`, `panic_lasterr`, `panic_optional_not_set`, `panic_result_not_set`, `print_backtrace`, `proc_pidpath`, `ptr_str`, `realloc_data`, `str_intp`, `str_intp_g32`, `str_intp_g64`, `str_intp_rune`, `str_intp_sq`, `str_intp_sub`, `string_from_wide`, `string_from_wide2`, `tos`, `tos2`, `tos3`, `tos4`, `tos5`, `tos_clone`, `utf32_decode_to_buffer`, `utf32_to_str`, `utf32_to_str_no_malloc`, `utf8_char_len`, `utf8_getchar`, `utf8_str_visible_length`, `v_realloc`, `vcalloc`, `vcalloc_noscan`, `vmemcmp`, `vmemcpy`, `vmemmove`, `vmemset`, `vstrlen`, `vstrlen_char`, `winapi_lasterr_str`, `reduce`, `string`, `join`, `free`, `join_lines`, `sort_by_len`, `sort_ignore_case`, `str`, `byterune`, `bytestr`, `clone`, `hex`, `utf8_to_utf32`, `vbytes`, `vstring`, `vstring_literal`, `vstring_literal_with_len`, `vstring_with_len`, `try_pop`, `try_push`, `strg`, `strsci`, `strlong`, `eq_epsilon`, `hex_full`, `hex2`, `msg`, `code`, `repeat`, `bytes`, `length_in_bytes`, `ascii_str`, `is_alnum`, `is_bin_digit`, `is_capital`, `is_digit`, `is_hex_digit`, `is_letter`, `is_oct_digit`, `is_space`, `str_escaped`, `repeat_to_depth`, `insert`, `prepend`, `trim`, `drop`, `first`, `last`, `pop`, `clone_to_depth`, `push_many`, `reverse_in_place`, `reverse`, `any`, `all`, `sort`, `sort_with_compare`, `contains`, `index`, `grow_cap`, `grow_len`, `pointers`, `move`, `keys`, `after`, `after_char`, `all_after`, `all_after_last`, `all_before`, `all_before_last`, `before`, `capitalize`, `compare`, `contains_any`, `contains_any_substr`, `count`, `ends_with`, `fields`, `find_between`, `hash`, `index_after`, `index_any`, `index_u8`, `is_lower`, `is_title`, `is_upper`, `last_index`, `last_index_u8`, `len_utf8`, `limit`, `match_glob`, `parse_int`, `parse_uint`, `replace`, `replace_each`, `replace_once`, `runes`, `split`, `split_any`, `split_into_lines`, `split_nth`, `starts_with`, `starts_with_capital`, `strip_margin`, `strip_margin_custom`, `substr`, `substr_ni`, `substr_with_check`, `title`, `to_lower`, `to_upper`, `to_wide`, `trim_left`, `trim_right`, `trim_space`, `trim_string_left`, `trim_string_right`, `utf32_code`), NameBuiltin, nil}, | ||||
| 			{Words(`\b(?<!@)`, `\b`, `ArrayFlags`, `AttributeKind`, `ChanState`, `StrIntpType`, `array`, `Error`, `FieldData`, `FunctionData`, `map`, `MethodArgs`, `SortedMap`, `string`, `StrIntpCgenData`, `StrIntpData`, `StrIntpMem`, `StructAttribute`, `VAssertMetaInfo`), NameBuiltin, nil}, | ||||
| 			{Words(`\b(?<!@)`, `\b`, `u8`, `u16`, `u32`, `u64`, `u128`, `int`, `i8`, `i16`, `i64`, `i128`, `f32`, `f64`, `rune`, `string`, `bool`, `usize`, `isize`, `any`, `error`, `voidptr`), KeywordType, nil}, | ||||
| 			{`\bit\b`, NameVariableMagic, nil}, | ||||
| 			{`(?<!fn\s+)(?<=\w+\s+|^)\[(?=:if +)?(?=\w+)`, Punctuation, Push(`attribute`)}, | ||||
| 			{`(<<=|>>=|>>>=|>>>|<<|>>|<=|>=|\^=|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|\.\.|[+\-*/%&|^~=#@!])`, Operator, nil}, | ||||
| 			{`[\d_]+(\.\d+e[+\-]?\d+|\.\d+|e[+\-]?\d+)`, LiteralNumberFloat, nil}, | ||||
| 			{`\.\d+(e[+\-]?\d+)?`, LiteralNumberFloat, nil}, | ||||
| 			{`0o[0-7_]+`, LiteralNumberOct, nil}, | ||||
| 			{`0x[0-9a-fA-F_]+`, LiteralNumberHex, nil}, | ||||
| 			{`0b[01_]+`, LiteralNumberBin, nil}, | ||||
| 			{`(0|[1-9][0-9_]*)`, LiteralNumberInteger, nil}, | ||||
| 			{"`", StringChar, Push(`char`)}, | ||||
| 			Include(`strings`), | ||||
| 			{`@?` + typeNamePattern, NameClass, nil}, | ||||
| 			{`(?<=` + namePattern + `)(<)(` + typeNamePattern + `)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil}, | ||||
| 			{`@?` + namePattern + `(?=\()`, NameFunction, nil}, | ||||
| 			{`(?<=fn\s+)@?` + namePattern + `(?=\s*\()`, NameFunction, nil}, | ||||
| 			{`(?<=(?:continue|break|goto)\s+)\w+`, NameLabel, nil}, | ||||
| 			{`\b` + namePattern + `(?=:(?:$|\s+for))`, NameLabel, nil}, | ||||
| 			{`[<>()\[\]{}.,;:]`, Punctuation, nil}, | ||||
| 			{`@?` + namePattern, NameVariable, nil}, | ||||
| 		}, | ||||
| 		"strings": { | ||||
| 			{`(c)?(")`, ByGroups(StringAffix, StringDouble), Push(`string-double`)}, | ||||
| 			{`(c)?(')`, ByGroups(StringAffix, StringSingle), Push(`string-single`)}, | ||||
| 			{`(r)("[^"]+")`, ByGroups(StringAffix, String), nil}, | ||||
| 			{`(r)('[^']+')`, ByGroups(StringAffix, String), nil}, | ||||
| 		}, | ||||
| 		"string-double": { | ||||
| 			{`"`, StringDouble, Pop(1)}, | ||||
| 			Include(`char-escape`), | ||||
| 			{`(\$)((?!\\){)`, ByGroups(Operator, Punctuation), Push(`string-curly-interpolation`)}, | ||||
| 			{`\$`, Operator, Push(`string-interpolation`)}, | ||||
| 			{`[^"]+?`, StringDouble, nil}, | ||||
| 		}, | ||||
| 		"string-single": { | ||||
| 			{`'`, StringSingle, Pop(1)}, | ||||
| 			Include(`char-escape`), | ||||
| 			{`(\$)((?!\\){)`, ByGroups(Operator, Punctuation), Push(`string-curly-interpolation`)}, | ||||
| 			{`\$`, Operator, Push(`string-interpolation`)}, | ||||
| 			{`[^']+?`, StringSingle, nil}, | ||||
| 		}, | ||||
| 		"char": { | ||||
| 			{"`", StringChar, Pop(1)}, | ||||
| 			Include(`char-escape`), | ||||
| 			{`[^\\]`, StringChar, nil}, | ||||
| 		}, | ||||
| 		"char-escape": { | ||||
| 			{"\\\\[`'\"\\\\abfnrtv$]|\\\\x[0-9a-fA-F]{2}|\\\\[0-7]{1,3}|\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}", StringEscape, nil}, | ||||
| 		}, | ||||
| 		"string-doc": { | ||||
| 			{`(// *)(#+ [^\n]+)(\n)`, ByGroups(StringDoc, GenericHeading, Text), nil}, | ||||
| 			{`// *([=_*~-])\1{2,}\n`, StringDelimiter, nil}, | ||||
| 			{`//[^\n]*\n`, StringDoc, nil}, | ||||
| 			Default(Pop(1)), | ||||
| 		}, | ||||
| 		"string-interpolation": { | ||||
| 			{`(\.)?(@)?(?:(` + namePattern + `)(\()([^)]*)(\))|(` + namePattern + `))`, ByGroups(Punctuation, Operator, NameFunction, Punctuation, UsingSelf(`root`), Punctuation, NameVariable), nil}, | ||||
| 			Default(Pop(1)), | ||||
| 		}, | ||||
| 		"string-curly-interpolation": { | ||||
| 			{`}`, Punctuation, Pop(1)}, | ||||
| 			Include(`strings`), | ||||
| 			{`(:)( *?)([ 0'#+-])?(?:(\.)?([0-9]+))?([fFgeEGxXobsd])?`, ByGroups(Punctuation, Text, Operator, Punctuation, Number, StringAffix), nil}, | ||||
| 			{`[^}"':]+`, UsingSelf(`root`), nil}, | ||||
| 		}, | ||||
| 		"attribute": { | ||||
| 			{`\]`, Punctuation, Pop(1)}, | ||||
| 			{`'`, Punctuation, Push(`string-single`)}, | ||||
| 			{`"`, Punctuation, Push(`string-double`)}, | ||||
| 			{`[;:]`, Punctuation, nil}, | ||||
| 			{`(?<=\[)if\b`, Keyword, nil}, | ||||
| 			{`\s+`, Text, nil}, | ||||
| 			{`(?<=: *)\w+`, String, nil}, | ||||
| 			{namePattern, NameAttribute, nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // V shell lexer. | ||||
| var VSH = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "V shell", | ||||
| 		Aliases:   []string{"vsh", "vshell"}, | ||||
| 		Filenames: []string{"*.vsh"}, | ||||
| 		MimeTypes: []string{"text/x-vsh"}, | ||||
| 		EnsureNL:  true, | ||||
| 	}, | ||||
| 	vshRules, | ||||
| ).SetAnalyser(func(text string) float32 { | ||||
| 	firstLine := strings.Split(text, "\n")[0] | ||||
| 	if strings.Contains(firstLine, "#!/usr/bin/env") && strings.Contains(firstLine, "v run") { | ||||
| 		return 1.0 | ||||
| 	} | ||||
| 	if strings.Contains(firstLine, "#!/") && strings.Contains(firstLine, "/v run") { | ||||
| 		return 1.0 | ||||
| 	} | ||||
| 	return 0.0 | ||||
| })) | ||||
|  | ||||
| func vshRules() Rules { | ||||
| 	vshRules := vRules() | ||||
| 	vshRoot := []Rule{ | ||||
| 		{`^#![^\n]*\n`, CommentHashbang, nil}, | ||||
| 		{Words(`\b`, `\b`, `args`, `max_path_len`, `wd_at_startup`, `sys_write`, `sys_open`, `sys_close`, `sys_mkdir`, `sys_creat`, `path_separator`, `path_delimiter`, `s_ifmt`, `s_ifdir`, `s_iflnk`, `s_isuid`, `s_isgid`, `s_isvtx`, `s_irusr`, `s_iwusr`, `s_ixusr`, `s_irgrp`, `s_iwgrp`, `s_ixgrp`, `s_iroth`, `s_iwoth`, `s_ixoth`), NameConstant, nil}, | ||||
| 		{Words(`\b`, `\b`, `ProcessState`, `SeekMode`, `Signal`, `Command`, `ExecutableNotFoundError`, `File`, `FileNotOpenedError`, `Process`, `Result`, `SizeOfTypeIs0Error`, `Uname`), NameBuiltin, nil}, | ||||
| 		{Words(`\b`, `(?=\()`, `abs_path`, `args_after`, `args_before`, `base`, `cache_dir`, `chdir`, `chmod`, `chown`, `config_dir`, `cp`, `cp_all`, `create`, `debugger_present`, `dir`, `environ`, `executable`, `execute`, `execute_or_exit`, `execute_or_panic`, `execve`, `execvp`, `existing_path`, `exists`, `exists_in_system_path`, `expand_tilde_to_home`, `fd_close`, `fd_read`, `fd_slurp`, `fd_write`, `file_ext`, `file_last_mod_unix`, `file_name`, `file_size`, `fileno`, `find_abs_path_of_executable`, `flush`, `fork`, `get_error_msg`, `get_line`, `get_lines`, `get_lines_joined`, `get_raw_line`, `get_raw_lines_joined`, `get_raw_stdin`, `getegid`, `getenv`, `getenv_opt`, `geteuid`, `getgid`, `getpid`, `getppid`, `getuid`, `getwd`, `glob`, `home_dir`, `hostname`, `inode`, `input`, `input_opt`, `is_abs_path`, `is_atty`, `is_dir`, `is_dir_empty`, `is_executable`, `is_file`, `is_link`, `is_readable`, `is_writable`, `is_writable_folder`, `join_path`, `join_path_single`, `last_error`, `link`, `log`, `loginname`, `ls`, `mkdir`, `mkdir_all`, `mv`, `mv_by_cp`, `new_process`, `norm_path`, `open`, `open_append`, `open_file`, `open_uri`, `posix_get_error_msg`, `posix_set_permission_bit`, `quoted_path`, `read_bytes`, `read_file`, `read_file_array`, `read_lines`, `real_path`, `resource_abs_path`, `rm`, `rmdir`, `rmdir_all`, `setenv`, `sigint_to_signal_name`, `signal_opt`, `stderr`, `stdin`, `stdout`, `symlink`, `system`, `temp_dir`, `truncate`, `uname`, `unsetenv`, `user_os`, `utime`, `vfopen`, `vmodules_dir`, `vmodules_paths`, `wait`, `walk`, `walk_ext`, `walk_with_context`, `write_file`, `write_file_array`, `bitmask`, `close`, `read_line`, `start`, `msg`, `read`, `read_bytes_at`, `read_bytes_into`, `read_bytes_into_newline`, `read_from`, `read_into_ptr`, `read_raw`, `read_raw_at`, `read_struct`, `read_struct_at`, `seek`, `tell`, `write`, `write_raw`, `write_raw_at`, `write_string`, `write_struct`, `write_struct_at`, `write_to`, `writeln`, `is_alive`, `run`, `set_args`, `set_environment`, `set_redirect_stdio`, `signal_continue`, `signal_kill`, `signal_pgkill`, `signal_stop`, `stderr_read`, `stderr_slurp`, `stdin_write`, `stdout_read`, `stdout_slurp`), NameBuiltin, nil}, | ||||
| 	} | ||||
|  | ||||
| 	vshRules[`root`] = append(vshRoot, vshRules[`root`]...) | ||||
|  | ||||
| 	return vshRules | ||||
| } | ||||
| @@ -1,40 +0,0 @@ | ||||
| package lexers | ||||
|  | ||||
| import ( | ||||
| 	. "github.com/alecthomas/chroma/v2" // nolint | ||||
| ) | ||||
|  | ||||
| // Viml lexer. | ||||
| var Viml = Register(MustNewLexer( | ||||
| 	&Config{ | ||||
| 		Name:      "VimL", | ||||
| 		Aliases:   []string{"vim"}, | ||||
| 		Filenames: []string{"*.vim", ".vimrc", ".exrc", ".gvimrc", "_vimrc", "_exrc", "_gvimrc", "vimrc", "gvimrc"}, | ||||
| 		MimeTypes: []string{"text/x-vim"}, | ||||
| 	}, | ||||
| 	vimlRules, | ||||
| )) | ||||
|  | ||||
| func vimlRules() Rules { | ||||
| 	return Rules{ | ||||
| 		"root": { | ||||
| 			{`^([ \t:]*)(py(?:t(?:h(?:o(?:n)?)?)?)?)([ \t]*)(<<)([ \t]*)(.*)((?:\n|.)*)(\6)`, ByGroups(UsingSelf("root"), Keyword, Text, Operator, Text, Text, Using("Python"), Text), nil}, | ||||
| 			{`^([ \t:]*)(py(?:t(?:h(?:o(?:n)?)?)?)?)([ \t])(.*)`, ByGroups(UsingSelf("root"), Keyword, Text, Using("Python")), nil}, | ||||
| 			{`^\s*".*`, Comment, nil}, | ||||
| 			{`[ \t]+`, Text, nil}, | ||||
| 			{`/(\\\\|\\/|[^\n/])*/`, LiteralStringRegex, nil}, | ||||
| 			{`"(\\\\|\\"|[^\n"])*"`, LiteralStringDouble, nil}, | ||||
| 			{`'(''|[^\n'])*'`, LiteralStringSingle, nil}, | ||||
| 			{`(?<=\s)"[^\-:.%#=*].*`, Comment, nil}, | ||||
| 			{`-?\d+`, LiteralNumber, nil}, | ||||
| 			{`#[0-9a-f]{6}`, LiteralNumberHex, nil}, | ||||
| 			{`^:`, Punctuation, nil}, | ||||
| 			{`[()<>+=!|,~-]`, Punctuation, nil}, | ||||
| 			{`\b(let|if|else|endif|elseif|fun|function|endfunction|set|map|autocmd|filetype|hi(ghlight)?|execute|syntax|colorscheme)\b`, Keyword, nil}, | ||||
| 			{`\b(NONE|bold|italic|underline|dark|light)\b`, NameBuiltin, nil}, | ||||
| 			{`\b\w+\b`, NameOther, nil}, | ||||
| 			{`\n`, Text, nil}, | ||||
| 			{`.`, Text, nil}, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -69,7 +69,7 @@ func (m *multiMutator) MarshalXML(e *xml.Encoder, start xml.StartElement) error | ||||
| 	return e.EncodeToken(xml.EndElement{Name: name}) | ||||
| } | ||||
|  | ||||
| func (m *multiMutator) MutatorKind() string { return "multiple" } | ||||
| func (m *multiMutator) MutatorKind() string { return "mutators" } | ||||
|  | ||||
| func (m *multiMutator) Mutate(state *LexerState) error { | ||||
| 	for _, modifier := range m.Mutators { | ||||
|   | ||||
| @@ -168,7 +168,7 @@ func NewXMLLexer(from fs.FS, path string) (*RegexLexer, error) { | ||||
| 					return 0 | ||||
| 				} | ||||
|  | ||||
| 				if ok && config.Analyse.Single { | ||||
| 				if ok && config.Analyse.First { | ||||
| 					return float32(math.Min(float64(ra.score), 1.0)) | ||||
| 				} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user