Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TOML = internal.Register(MustNewLexer( &Config{ Name: "TOML", Aliases: []string{"toml"}, Filenames: []string{"*.toml"}, MimeTypes: []string{"text/x-toml"}, }, Rules{ "root": { {`\s+`, Text, nil}, {`#.*`, Comment, nil}, {Words(``, `\b`, `true`, `false`), KeywordConstant, nil}, {`\d\d\d\d-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d\+)?(Z|[+-]\d{2}:\d{2})`, LiteralDate, nil}, {`[+-]?[0-9](_?\d)*\.\d+`, LiteralNumberFloat, nil}, {`[+-]?[0-9](_?\d)*`, LiteralNumberInteger, nil}, {`"(\\\\|\\"|[^"])*"`, StringDouble, nil}, {`'(\\\\|\\'|[^'])*'`, StringSingle, nil}, {`[.,=\[\]]`, Punctuation, nil}, {`[^\W\d]\w*`, NameOther, nil}, }, }, ))
View Source
var Tasm = internal.Register(MustNewLexer( &Config{ Name: "TASM", Aliases: []string{"tasm"}, Filenames: []string{"*.asm", "*.ASM", "*.tasm"}, MimeTypes: []string{"text/x-tasm"}, CaseInsensitive: true, }, Rules{ "root": { {`^\s*%`, CommentPreproc, Push("preproc")}, Include("whitespace"), {`[@a-z$._?][\w$.?#@~]*:`, NameLabel, nil}, {`BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|ENDS|COMMON|CPU|GROUP|UPPERCASE|INCLUDE|EXPORT|LIBRARY|MODULE|PROC|ENDP|USES|ARG|DATASEG|UDATASEG|END|IDEAL|P386|MODEL|ASSUME|CODESEG|SIZE`, Keyword, Push("instruction-args")}, {`([@a-z$._?][\w$.?#@~]*)(\s+)(db|dd|dw|T[A-Z][a-z]+)`, ByGroups(NameConstant, KeywordDeclaration, KeywordDeclaration), Push("instruction-args")}, {`(?:res|d)[bwdqt]|times`, KeywordDeclaration, Push("instruction-args")}, {`[@a-z$._?][\w$.?#@~]*`, NameFunction, Push("instruction-args")}, {`[\r\n]+`, Text, nil}, }, "instruction-args": { {"\"(\\\\\"|[^\"\\n])*\"|'(\\\\'|[^'\\n])*'|`(\\\\`|[^`\\n])*`", LiteralString, nil}, {`(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)`, LiteralNumberHex, nil}, {`[0-7]+q`, LiteralNumberOct, nil}, {`[01]+b`, LiteralNumberBin, nil}, {`[0-9]+\.e?[0-9]+`, LiteralNumberFloat, nil}, {`[0-9]+`, LiteralNumberInteger, nil}, Include("punctuation"), {`r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]`, NameBuiltin, nil}, {`[@a-z$._?][\w$.?#@~]*`, NameVariable, nil}, {`(\\\s*)(;.*)([\r\n])`, ByGroups(Text, CommentSingle, Text), nil}, {`[\r\n]+`, Text, Pop(1)}, Include("whitespace"), }, "preproc": { {`[^;\n]+`, CommentPreproc, nil}, {`;.*?\n`, CommentSingle, Pop(1)}, {`\n`, CommentPreproc, Pop(1)}, }, "whitespace": { {`[\n\r]`, Text, nil}, {`\\[\n\r]`, Text, nil}, {`[ \t]+`, Text, nil}, {`;.*`, CommentSingle, nil}, }, "punctuation": { {`[,():\[\]]+`, Punctuation, nil}, {`[&|^<>+*=/%~-]+`, Operator, nil}, {`[$]+`, KeywordConstant, nil}, {`seg|wrt|strict`, OperatorWord, nil}, {`byte|[dq]?word`, KeywordType, nil}, }, }, ))
Tasm lexer.
View Source
var Tcl = internal.Register(MustNewLexer( &Config{ Name: "Tcl", Aliases: []string{"tcl"}, Filenames: []string{"*.tcl", "*.rvt"}, MimeTypes: []string{"text/x-tcl", "text/x-script.tcl", "application/x-tcl"}, }, Rules{ "root": { Include("command"), Include("basic"), Include("data"), {`\}`, Keyword, nil}, }, "command": { {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params")}, {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params")}, {`([\w.-]+)`, NameVariable, Push("params")}, {`#`, Comment, Push("comment")}, }, "command-in-brace": { {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-brace")}, {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-brace")}, {`([\w.-]+)`, NameVariable, Push("params-in-brace")}, {`#`, Comment, Push("comment")}, }, "command-in-bracket": { {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-bracket")}, {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-bracket")}, {`([\w.-]+)`, NameVariable, Push("params-in-bracket")}, {`#`, Comment, Push("comment")}, }, "command-in-paren": { {Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-paren")}, {Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-paren")}, {`([\w.-]+)`, NameVariable, Push("params-in-paren")}, {`#`, Comment, Push("comment")}, }, "basic": { {`\(`, Keyword, Push("paren")}, {`\[`, Keyword, Push("bracket")}, {`\{`, Keyword, Push("brace")}, {`"`, LiteralStringDouble, Push("string")}, {`(eq|ne|in|ni)\b`, OperatorWord, nil}, {`!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]`, Operator, nil}, }, "data": { {`\s+`, Text, nil}, {`0x[a-fA-F0-9]+`, LiteralNumberHex, nil}, {`0[0-7]+`, LiteralNumberOct, nil}, {`\d+\.\d+`, LiteralNumberFloat, nil}, {`\d+`, LiteralNumberInteger, nil}, {`\$([\w.:-]+)`, NameVariable, nil}, {`([\w.:-]+)`, Text, nil}, }, "params": { {`;`, Keyword, Pop(1)}, {`\n`, Text, Pop(1)}, {`(else|elseif|then)\b`, Keyword, nil}, Include("basic"), Include("data"), }, "params-in-brace": { {`\}`, Keyword, Push("#pop", "#pop")}, Include("params"), }, "params-in-paren": { {`\)`, Keyword, Push("#pop", "#pop")}, Include("params"), }, "params-in-bracket": { {`\]`, Keyword, Push("#pop", "#pop")}, Include("params"), }, "string": { {`\[`, LiteralStringDouble, Push("string-square")}, {`(?s)(\\\\|\\[0-7]+|\\.|[^"\\])`, LiteralStringDouble, nil}, {`"`, LiteralStringDouble, Pop(1)}, }, "string-square": { {`\[`, LiteralStringDouble, Push("string-square")}, {`(?s)(\\\\|\\[0-7]+|\\.|\\\n|[^\]\\])`, LiteralStringDouble, nil}, {`\]`, LiteralStringDouble, Pop(1)}, }, "brace": { {`\}`, Keyword, Pop(1)}, Include("command-in-brace"), Include("basic"), Include("data"), }, "paren": { {`\)`, Keyword, Pop(1)}, Include("command-in-paren"), Include("basic"), Include("data"), }, "bracket": { {`\]`, Keyword, Pop(1)}, Include("command-in-bracket"), Include("basic"), Include("data"), }, "comment": { {`.*[^\\]\n`, Comment, Pop(1)}, {`.*\\\n`, Comment, nil}, }, }, ))
Tcl lexer.
View Source
var Tcsh = internal.Register(MustNewLexer( &Config{ Name: "Tcsh", Aliases: []string{"tcsh", "csh"}, Filenames: []string{"*.tcsh", "*.csh"}, MimeTypes: []string{"application/x-csh"}, }, Rules{ "root": { Include("basic"), {`\$\(`, Keyword, Push("paren")}, {`\$\{#?`, Keyword, Push("curly")}, {"`", LiteralStringBacktick, Push("backticks")}, Include("data"), }, "basic": { {`\b(if|endif|else|while|then|foreach|case|default|continue|goto|breaksw|end|switch|endsw)\s*\b`, Keyword, nil}, {`\b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|glob|getspath|hashstat|history|hup|inlib|jobs|kill|limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|source|stop|suspend|source|suspend|telltc|time|umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|ver|wait|warp|watchlog|where|which)\s*\b`, NameBuiltin, nil}, {`#.*`, Comment, nil}, {`\\[\w\W]`, LiteralStringEscape, nil}, {`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil}, {`[\[\]{}()=]+`, Operator, nil}, {`<<\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil}, {`;`, Punctuation, nil}, }, "data": { {`(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"`, LiteralStringDouble, nil}, {`(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil}, {`\s+`, Text, nil}, {"[^=\\s\\[\\]{}()$\"\\'`\\\\;#]+", Text, nil}, {`\d+(?= |\Z)`, LiteralNumber, nil}, {`\$#?(\w+|.)`, NameVariable, nil}, }, "curly": { {`\}`, Keyword, Pop(1)}, {`:-`, Keyword, nil}, {`\w+`, NameVariable, nil}, {"[^}:\"\\'`$]+", Punctuation, nil}, {`:`, Punctuation, nil}, Include("root"), }, "paren": { {`\)`, Keyword, Pop(1)}, Include("root"), }, "backticks": { {"`", LiteralStringBacktick, Pop(1)}, Include("root"), }, }, ))
Tcsh lexer.
View Source
var TeX = internal.Register(MustNewLexer( &Config{ Name: "TeX", Aliases: []string{"tex", "latex"}, Filenames: []string{"*.tex", "*.aux", "*.toc"}, MimeTypes: []string{"text/x-tex", "text/x-latex"}, }, Rules{ "general": { {`%.*?\n`, Comment, nil}, {`[{}]`, NameBuiltin, nil}, {`[&_^]`, NameBuiltin, nil}, }, "root": { {`\\\[`, LiteralStringBacktick, Push("displaymath")}, {`\\\(`, LiteralString, Push("inlinemath")}, {`\$\$`, LiteralStringBacktick, Push("displaymath")}, {`\$`, LiteralString, Push("inlinemath")}, {`\\([a-zA-Z]+|.)`, Keyword, Push("command")}, {`\\$`, Keyword, nil}, Include("general"), {`[^\\$%&_^{}]+`, Text, nil}, }, "math": { {`\\([a-zA-Z]+|.)`, NameVariable, nil}, Include("general"), {`[0-9]+`, LiteralNumber, nil}, {`[-=!+*/()\[\]]`, Operator, nil}, {`[^=!+*/()\[\]\\$%&_^{}0-9-]+`, NameBuiltin, nil}, }, "inlinemath": { {`\\\)`, LiteralString, Pop(1)}, {`\$`, LiteralString, Pop(1)}, Include("math"), }, "displaymath": { {`\\\]`, LiteralString, Pop(1)}, {`\$\$`, LiteralString, Pop(1)}, {`\$`, NameBuiltin, nil}, Include("math"), }, "command": { {`\[.*?\]`, NameAttribute, nil}, {`\*`, Keyword, nil}, Default(Pop(1)), }, }, ))
Tex lexer.
View Source
var Termcap = internal.Register(MustNewLexer( &Config{ Name: "Termcap", Aliases: []string{"termcap"}, Filenames: []string{"termcap", "termcap.src"}, MimeTypes: []string{}, }, Rules{ "root": { {`^#.*$`, Comment, nil}, {`^[^\s#:|]+`, NameTag, Push("names")}, }, "names": { {`\n`, Text, Pop(1)}, {`:`, Punctuation, Push("defs")}, {`\|`, Punctuation, nil}, {`[^:|]+`, NameAttribute, nil}, }, "defs": { {`\\\n[ \t]*`, Text, nil}, {`\n[ \t]*`, Text, Pop(2)}, {`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil}, {`=`, Operator, Push("data")}, {`:`, Punctuation, nil}, {`[^\s:=#]+`, NameClass, nil}, }, "data": { {`\\072`, Literal, nil}, {`:`, Punctuation, Pop(1)}, {`[^:\\]+`, Literal, nil}, {`.`, Literal, nil}, }, }, ))
Termcap lexer.
View Source
var Terminfo = internal.Register(MustNewLexer( &Config{ Name: "Terminfo", Aliases: []string{"terminfo"}, Filenames: []string{"terminfo", "terminfo.src"}, MimeTypes: []string{}, }, Rules{ "root": { {`^#.*$`, Comment, nil}, {`^[^\s#,|]+`, NameTag, Push("names")}, }, "names": { {`\n`, Text, Pop(1)}, {`(,)([ \t]*)`, ByGroups(Punctuation, Text), Push("defs")}, {`\|`, Punctuation, nil}, {`[^,|]+`, NameAttribute, nil}, }, "defs": { {`\n[ \t]+`, Text, nil}, {`\n`, Text, Pop(2)}, {`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil}, {`=`, Operator, Push("data")}, {`(,)([ \t]*)`, ByGroups(Punctuation, Text), nil}, {`[^\s,=#]+`, NameClass, nil}, }, "data": { {`\\[,\\]`, Literal, nil}, {`(,)([ \t]*)`, ByGroups(Punctuation, Text), Pop(1)}, {`[^\\,]+`, Literal, nil}, {`.`, Literal, nil}, }, }, ))
Terminfo lexer.
View Source
var Terraform = internal.Register(MustNewLexer( &Config{ Name: "Terraform", Aliases: []string{"terraform", "tf"}, Filenames: []string{"*.tf"}, MimeTypes: []string{"application/x-tf", "application/x-terraform"}, }, Rules{ "root": { Include("string"), Include("punctuation"), Include("curly"), Include("basic"), Include("whitespace"), {`[0-9]+`, LiteralNumber, nil}, }, "basic": { {Words(`\b`, `\b`, `true`, `false`), KeywordType, nil}, {`\s*/\*`, CommentMultiline, Push("comment")}, {`\s*#.*\n`, CommentSingle, nil}, {`(.*?)(\s*)(=)`, ByGroups(NameAttribute, Text, Operator), nil}, {Words(`\b`, `\b`, `variable`, `resource`, `provider`, `provisioner`, `module`), KeywordReserved, Push("function")}, {Words(`\b`, `\b`, `ingress`, `egress`, `listener`, `default`, `connection`, `alias`), KeywordDeclaration, nil}, {`\$\{`, LiteralStringInterpol, Push("var_builtin")}, }, "function": { {`(\s+)(".*")(\s+)`, ByGroups(Text, LiteralString, Text), nil}, Include("punctuation"), Include("curly"), }, "var_builtin": { {`\$\{`, LiteralStringInterpol, Push()}, {Words(`\b`, `\b`, `concat`, `file`, `join`, `lookup`, `element`), NameBuiltin, nil}, Include("string"), Include("punctuation"), {`\s+`, Text, nil}, {`\}`, LiteralStringInterpol, Pop(1)}, }, "string": { {`(".*")`, ByGroups(LiteralStringDouble), nil}, }, "punctuation": { {`[\[\](),.]`, Punctuation, nil}, }, "curly": { {`\{`, TextPunctuation, nil}, {`\}`, TextPunctuation, nil}, }, "comment": { {`[^*/]`, CommentMultiline, nil}, {`/\*`, CommentMultiline, Push()}, {`\*/`, CommentMultiline, Pop(1)}, {`[*/]`, CommentMultiline, nil}, }, "whitespace": { {`\n`, Text, nil}, {`\s+`, Text, nil}, {`\\\n`, Text, nil}, }, }, ))
Terraform lexer.
View Source
var Thrift = internal.Register(MustNewLexer( &Config{ Name: "Thrift", Aliases: []string{"thrift"}, Filenames: []string{"*.thrift"}, MimeTypes: []string{"application/x-thrift"}, }, Rules{ "root": { Include("whitespace"), Include("comments"), {`"`, LiteralStringDouble, Combined("stringescape", "dqs")}, {`\'`, LiteralStringSingle, Combined("stringescape", "sqs")}, {`(namespace)(\s+)`, ByGroups(KeywordNamespace, TextWhitespace), Push("namespace")}, {`(enum|union|struct|service|exception)(\s+)`, ByGroups(KeywordDeclaration, TextWhitespace), Push("class")}, {`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil}, Include("keywords"), Include("numbers"), {`[&=]`, Operator, nil}, {`[:;,{}()<>\[\]]`, Punctuation, nil}, {`[a-zA-Z_](\.\w|\w)*`, Name, nil}, }, "whitespace": { {`\n`, TextWhitespace, nil}, {`\s+`, TextWhitespace, nil}, }, "comments": { {`#.*$`, Comment, nil}, {`//.*?\n`, Comment, nil}, {`/\*[\w\W]*?\*/`, CommentMultiline, nil}, }, "stringescape": { {`\\([\\nrt"\'])`, LiteralStringEscape, nil}, }, "dqs": { {`"`, LiteralStringDouble, Pop(1)}, {`[^\\"\n]+`, LiteralStringDouble, nil}, }, "sqs": { {`'`, LiteralStringSingle, Pop(1)}, {`[^\\\'\n]+`, LiteralStringSingle, nil}, }, "namespace": { {`[a-z*](\.\w|\w)*`, NameNamespace, Pop(1)}, Default(Pop(1)), }, "class": { {`[a-zA-Z_]\w*`, NameClass, Pop(1)}, Default(Pop(1)), }, "keywords": { {`(async|oneway|extends|throws|required|optional)\b`, Keyword, nil}, {`(true|false)\b`, KeywordConstant, nil}, {`(const|typedef)\b`, KeywordDeclaration, nil}, {Words(``, `\b`, `cpp_namespace`, `cpp_include`, `cpp_type`, `java_package`, `cocoa_prefix`, `csharp_namespace`, `delphi_namespace`, `php_namespace`, `py_module`, `perl_package`, `ruby_namespace`, `smalltalk_category`, `smalltalk_prefix`, `xsd_all`, `xsd_optional`, `xsd_nillable`, `xsd_namespace`, `xsd_attrs`, `include`), KeywordNamespace, nil}, {Words(``, `\b`, `void`, `bool`, `byte`, `i16`, `i32`, `i64`, `double`, `string`, `binary`, `map`, `list`, `set`, `slist`, `senum`), KeywordType, nil}, {Words(`\b`, `\b`, `BEGIN`, `END`, `__CLASS__`, `__DIR__`, `__FILE__`, `__FUNCTION__`, `__LINE__`, `__METHOD__`, `__NAMESPACE__`, `abstract`, `alias`, `and`, `args`, `as`, `assert`, `begin`, `break`, `case`, `catch`, `class`, `clone`, `continue`, `declare`, `def`, `default`, `del`, `delete`, `do`, `dynamic`, `elif`, `else`, `elseif`, `elsif`, `end`, `enddeclare`, `endfor`, `endforeach`, `endif`, `endswitch`, `endwhile`, `ensure`, `except`, `exec`, `finally`, `float`, `for`, `foreach`, `function`, `global`, `goto`, `if`, `implements`, `import`, `in`, `inline`, `instanceof`, `interface`, `is`, `lambda`, `module`, `native`, `new`, `next`, `nil`, `not`, `or`, `pass`, `public`, `print`, `private`, `protected`, `raise`, `redo`, `rescue`, `retry`, `register`, `return`, `self`, `sizeof`, `static`, `super`, `switch`, `synchronized`, `then`, `this`, `throw`, `transient`, `try`, `undef`, `unless`, `unsigned`, `until`, `use`, `var`, `virtual`, `volatile`, `when`, `while`, `with`, `xor`, `yield`), KeywordReserved, nil}, }, "numbers": { {`[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)`, LiteralNumberFloat, nil}, {`[+-]?0x[0-9A-Fa-f]+`, LiteralNumberHex, nil}, {`[+-]?[0-9]+`, LiteralNumberInteger, nil}, }, }, ))
Thrift lexer.
View Source
var TransactSQL = internal.Register(MustNewLexer( &Config{ Name: "Transact-SQL", Aliases: []string{"tsql", "t-sql"}, MimeTypes: []string{"text/x-tsql"}, NotMultiline: true, CaseInsensitive: true, }, Rules{ "root": { {`\s+`, TextWhitespace, nil}, {`--(?m).*?$\n?`, CommentSingle, nil}, {`/\*`, CommentMultiline, Push("multiline-comments")}, {`'`, LiteralStringSingle, Push("string")}, {`"`, LiteralStringName, Push("quoted-ident")}, {Words(``, ``, `!<`, `!=`, `!>`, `<`, `<=`, `<>`, `=`, `>`, `>=`, `+`, `+=`, `-`, `-=`, `*`, `*=`, `/`, `/=`, `%`, `%=`, `&`, `&=`, `|`, `|=`, `^`, `^=`, `~`, `::`), Operator, nil}, {Words(``, `\b`, `all`, `and`, `any`, `between`, `except`, `exists`, `in`, `intersect`, `like`, `not`, `or`, `some`, `union`), OperatorWord, nil}, {Words(``, `\b`, `bigint`, `binary`, `bit`, `char`, `cursor`, `date`, `datetime`, `datetime2`, `datetimeoffset`, `decimal`, `float`, `hierarchyid`, `image`, `int`, `money`, `nchar`, `ntext`, `numeric`, `nvarchar`, `real`, `smalldatetime`, `smallint`, `smallmoney`, `sql_variant`, `table`, `text`, `time`, `timestamp`, `tinyint`, `uniqueidentifier`, `varbinary`, `varchar`, `xml`), NameClass, nil}, {Words(``, `\b`, `$partition`, `abs`, `acos`, `app_name`, `applock_mode`, `applock_test`, `ascii`, `asin`, `assemblyproperty`, `atan`, `atn2`, `avg`, `binary_checksum`, `cast`, `ceiling`, `certencoded`, `certprivatekey`, `char`, `charindex`, `checksum`, `checksum_agg`, `choose`, `col_length`, `col_name`, `columnproperty`, `compress`, `concat`, `connectionproperty`, `context_info`, `convert`, `cos`, `cot`, `count`, `count_big`, `current_request_id`, `current_timestamp`, `current_transaction_id`, `current_user`, `cursor_status`, `database_principal_id`, `databasepropertyex`, `dateadd`, `datediff`, `datediff_big`, `datefromparts`, `datename`, `datepart`, `datetime2fromparts`, `datetimefromparts`, `datetimeoffsetfromparts`, `day`, `db_id`, `db_name`, `decompress`, `degrees`, `dense_rank`, `difference`, `eomonth`, `error_line`, `error_message`, `error_number`, `error_procedure`, `error_severity`, `error_state`, `exp`, `file_id`, `file_idex`, `file_name`, `filegroup_id`, `filegroup_name`, `filegroupproperty`, `fileproperty`, `floor`, `format`, `formatmessage`, `fulltextcatalogproperty`, `fulltextserviceproperty`, `get_filestream_transaction_context`, `getansinull`, `getdate`, `getutcdate`, `grouping`, `grouping_id`, `has_perms_by_name`, `host_id`, `host_name`, `iif`, `index_col`, `indexkey_property`, `indexproperty`, `is_member`, `is_rolemember`, `is_srvrolemember`, `isdate`, `isjson`, `isnull`, `isnumeric`, `json_modify`, `json_query`, `json_value`, `left`, `len`, `log`, `log10`, `lower`, `ltrim`, `max`, `min`, `min_active_rowversion`, `month`, `nchar`, `newid`, `newsequentialid`, `ntile`, `object_definition`, `object_id`, `object_name`, `object_schema_name`, `objectproperty`, `objectpropertyex`, `opendatasource`, `openjson`, `openquery`, `openrowset`, `openxml`, `original_db_name`, `original_login`, `parse`, `parsename`, `patindex`, `permissions`, `pi`, `power`, `pwdcompare`, `pwdencrypt`, `quotename`, `radians`, `rand`, `rank`, `replace`, `replicate`, `reverse`, `right`, `round`, `row_number`, `rowcount_big`, `rtrim`, `schema_id`, `schema_name`, `scope_identity`, `serverproperty`, `session_context`, `session_user`, `sign`, `sin`, `smalldatetimefromparts`, `soundex`, `sp_helplanguage`, `space`, `sqrt`, `square`, `stats_date`, `stdev`, `stdevp`, `str`, `string_escape`, `string_split`, `stuff`, `substring`, `sum`, `suser_id`, `suser_name`, `suser_sid`, `suser_sname`, `switchoffset`, `sysdatetime`, `sysdatetimeoffset`, `system_user`, `sysutcdatetime`, `tan`, `textptr`, `textvalid`, `timefromparts`, `todatetimeoffset`, `try_cast`, `try_convert`, `try_parse`, `type_id`, `type_name`, `typeproperty`, `unicode`, `upper`, `user_id`, `user_name`, `var`, `varp`, `xact_state`, `year`), NameFunction, nil}, {`(goto)(\s+)(\w+\b)`, ByGroups(Keyword, TextWhitespace, NameLabel), nil}, {Words(``, `\b`, `absolute`, `action`, `ada`, `add`, `admin`, `after`, `aggregate`, `alias`, `all`, `allocate`, `alter`, `and`, `any`, `are`, `array`, `as`, `asc`, `asensitive`, `assertion`, `asymmetric`, `at`, `atomic`, `authorization`, `avg`, `backup`, `before`, `begin`, `between`, `binary`, `bit`, `bit_length`, `blob`, `boolean`, `both`, `breadth`, `break`, `browse`, `bulk`, `by`, `call`, `called`, `cardinality`, `cascade`, `cascaded`, `case`, `cast`, `catalog`, `catch`, `char`, `char_length`, `character`, `character_length`, `check`, `checkpoint`, `class`, `clob`, `close`, `clustered`, `coalesce`, `collate`, `collation`, `collect`, `column`, `commit`, `completion`, `compute`, `condition`, `connect`, `connection`, `constraint`, `constraints`, `constructor`, `contains`, `containstable`, `continue`, `convert`, `corr`, `corresponding`, `count`, `covar_pop`, `covar_samp`, `create`, `cross`, `cube`, `cume_dist`, `current`, `current_catalog`, `current_date`, `current_default_transform_group`, `current_path`, `current_role`, `current_schema`, `current_time`, `current_timestamp`, `current_transform_group_for_type`, `current_user`, `cursor`, `cycle`, `data`, `database`, `date`, `day`, `dbcc`, `deallocate`, `dec`, `decimal`, `declare`, `default`, `deferrable`, `deferred`, `delete`, `deny`, `depth`, `deref`, `desc`, `describe`, `descriptor`, `destroy`, `destructor`, `deterministic`, `diagnostics`, `dictionary`, `disconnect`, `disk`, `distinct`, `distributed`, `domain`, `double`, `drop`, `dump`, `dynamic`, `each`, `element`, `else`, `end`, `end-exec`, `equals`, `errlvl`, `escape`, `every`, `except`, `exception`, `exec`, `execute`, `exists`, `exit`, `external`, `extract`, `false`, `fetch`, `file`, `fillfactor`, `filter`, `first`, `float`, `for`, `foreign`, `fortran`, `found`, `free`, `freetext`, `freetexttable`, `from`, `full`, `fulltexttable`, `function`, `fusion`, `general`, `get`, `global`, `go`, `goto`, `grant`, `group`, `grouping`, `having`, `hold`, `holdlock`, `host`, `hour`, `identity`, `identity_insert`, `identitycol`, `if`, `ignore`, `immediate`, `in`, `include`, `index`, `indicator`, `initialize`, `initially`, `inner`, `inout`, `input`, `insensitive`, `insert`, `int`, `integer`, `intersect`, `intersection`, `interval`, `into`, `is`, `isolation`, `iterate`, `join`, `key`, `kill`, `language`, `large`, `last`, `lateral`, `leading`, `left`, `less`, `level`, `like`, `like_regex`, `limit`, `lineno`, `ln`, `load`, `local`, `localtime`, `localtimestamp`, `locator`, `lower`, `map`, `match`, `max`, `member`, `merge`, `method`, `min`, `minute`, `mod`, `modifies`, `modify`, `module`, `month`, `multiset`, `names`, `national`, `natural`, `nchar`, `nclob`, `new`, `next`, `no`, `nocheck`, `nonclustered`, `none`, `normalize`, `not`, `null`, `nullif`, `numeric`, `object`, `occurrences_regex`, `octet_length`, `of`, `off`, `offsets`, `old`, `on`, `only`, `open`, `opendatasource`, `openquery`, `openrowset`, `openxml`, `operation`, `option`, `or`, `order`, `ordinality`, `out`, `outer`, `output`, `over`, `overlaps`, `overlay`, `pad`, `parameter`, `parameters`, `partial`, `partition`, `pascal`, `path`, `percent`, `percent_rank`, `percentile_cont`, `percentile_disc`, `pivot`, `plan`, `position`, `position_regex`, `postfix`, `precision`, `prefix`, `preorder`, `prepare`, `preserve`, `primary`, `print`, `prior`, `privileges`, `proc`, `procedure`, `public`, `raiserror`, `range`, `read`, `reads`, `readtext`, `real`, `reconfigure`, `recursive`, `ref`, `references`, `referencing`, `regr_avgx`, `regr_avgy`, `regr_count`, `regr_intercept`, `regr_r2`, `regr_slope`, `regr_sxx`, `regr_sxy`, `regr_syy`, `relative`, `release`, `replication`, `restore`, `restrict`, `result`, `return`, `returns`, `revert`, `revoke`, `right`, `role`, `rollback`, `rollup`, `routine`, `row`, `rowcount`, `rowguidcol`, `rows`, `rule`, `save`, `savepoint`, `schema`, `scope`, `scroll`, `search`, `second`, `section`, `securityaudit`, `select`, `semantickeyphrasetable`, `semanticsimilaritydetailstable`, `semanticsimilaritytable`, `sensitive`, `sequence`, `session`, `session_user`, `set`, `sets`, `setuser`, `shutdown`, `similar`, `size`, `smallint`, `some`, `space`, `specific`, `specifictype`, `sql`, `sqlca`, `sqlcode`, `sqlerror`, `sqlexception`, `sqlstate`, `sqlwarning`, `start`, `state`, `statement`, `static`, `statistics`, `stddev_pop`, `stddev_samp`, `structure`, `submultiset`, `substring`, `substring_regex`, `sum`, `symmetric`, `system`, `system_user`, `table`, `tablesample`, `temporary`, `terminate`, `textsize`, `than`, `then`, `throw`, `time`, `timestamp`, `timezone_hour`, `timezone_minute`, `to`, `top`, `trailing`, `tran`, `transaction`, `translate`, `translate_regex`, `translation`, `treat`, `trigger`, `trim`, `true`, `truncate`, `try`, `try_convert`, `tsequal`, `uescape`, `under`, `union`, `unique`, `unknown`, `unnest`, `unpivot`, `update`, `updatetext`, `upper`, `usage`, `use`, `user`, `using`, `value`, `values`, `var_pop`, `var_samp`, `varchar`, `variable`, `varying`, `view`, `waitfor`, `when`, `whenever`, `where`, `while`, `width_bucket`, `window`, `with`, `within`, `without`, `work`, `write`, `writetext`, `xmlagg`, `xmlattributes`, `xmlbinary`, `xmlcast`, `xmlcomment`, `xmlconcat`, `xmldocument`, `xmlelement`, `xmlexists`, `xmlforest`, `xmliterate`, `xmlnamespaces`, `xmlparse`, `xmlpi`, `xmlquery`, `xmlserialize`, `xmltable`, `xmltext`, `xmlvalidate`, `year`, `zone`), Keyword, nil}, {`(\[)([^]]+)(\])`, ByGroups(Operator, Name, Operator), nil}, {`0x[0-9a-f]+`, LiteralNumberHex, nil}, {`[0-9]+\.[0-9]*(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, {`\.[0-9]+(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, {`[0-9]+e[+-]?[0-9]+`, LiteralNumberFloat, nil}, {`[0-9]+`, LiteralNumberInteger, nil}, {`[;(),.]`, Punctuation, nil}, {`@@\w+`, NameBuiltin, nil}, {`@\w+`, NameVariable, nil}, {`(\w+)(:)`, ByGroups(NameLabel, Punctuation), nil}, {`#?#?\w+`, Name, nil}, {`\?`, NameVariableMagic, 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)}, }, }, ))
TransactSQL lexer.
View Source
var Turtle = internal.Register(MustNewLexer( &Config{ Name: "Turtle", Aliases: []string{"turtle"}, Filenames: []string{"*.ttl"}, MimeTypes: []string{"text/turtle", "application/x-turtle"}, NotMultiline: true, CaseInsensitive: true, }, Rules{ "root": { {`\s+`, TextWhitespace, nil}, {"(@base|BASE)(\\s+)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil}, {"(@prefix|PREFIX)(\\s+)((?:[a-z][\\w-]*)?\\:)(\\s+)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameNamespace, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil}, {`(?<=\s)a(?=\s)`, KeywordType, nil}, {"(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", NameVariable, nil}, {`((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(NameNamespace, NameTag), nil}, {`#[^\n]+`, Comment, nil}, {`\b(true|false)\b`, Literal, nil}, {`[+\-]?\d*\.\d+`, LiteralNumberFloat, nil}, {`[+\-]?\d*(:?\.\d+)?E[+\-]?\d+`, LiteralNumberFloat, nil}, {`[+\-]?\d+`, LiteralNumberInteger, nil}, {`[\[\](){}.;,:^]`, Punctuation, nil}, {`"""`, LiteralString, Push("triple-double-quoted-string")}, {`"`, LiteralString, Push("single-double-quoted-string")}, {`'''`, LiteralString, Push("triple-single-quoted-string")}, {`'`, LiteralString, Push("single-single-quoted-string")}, }, "triple-double-quoted-string": { {`"""`, LiteralString, Push("end-of-string")}, {`[^\\]+`, LiteralString, nil}, {`\\`, LiteralString, Push("string-escape")}, }, "single-double-quoted-string": { {`"`, LiteralString, Push("end-of-string")}, {`[^"\\\n]+`, LiteralString, nil}, {`\\`, LiteralString, Push("string-escape")}, }, "triple-single-quoted-string": { {`'''`, LiteralString, Push("end-of-string")}, {`[^\\]+`, LiteralString, nil}, {`\\`, LiteralString, Push("string-escape")}, }, "single-single-quoted-string": { {`'`, LiteralString, Push("end-of-string")}, {`[^'\\\n]+`, LiteralString, nil}, {`\\`, LiteralString, Push("string-escape")}, }, "string-escape": { {`.`, LiteralString, Pop(1)}, }, "end-of-string": { {`(@)([a-z]+(:?-[a-z0-9]+)*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)}, {"(\\^\\^)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", ByGroups(Operator, GenericEmph), Pop(2)}, {`(\^\^)((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)}, Default(Pop(2)), }, }, ))
Turtle lexer.
View Source
var Twig = internal.Register(MustNewLexer( &Config{ Name: "Twig", Aliases: []string{"twig"}, Filenames: []string{}, MimeTypes: []string{"application/x-twig"}, DotAll: true, }, Rules{ "root": { {`[^{]+`, Other, nil}, {`\{\{`, CommentPreproc, Push("var")}, {`\{\#.*?\#\}`, Comment, nil}, {`(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Other, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil}, {`(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Other, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil}, {`(\{%)(-?\s*)(filter)(\s+)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(CommentPreproc, Text, Keyword, Text, NameFunction), Push("tag")}, {`(\{%)(-?\s*)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword), Push("tag")}, {`\{`, Other, nil}, }, "varnames": { {`(\|)(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(Operator, Text, NameFunction), nil}, {`(is)(\s+)(not)?(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil}, {`(?i)(true|false|none|null)\b`, KeywordPseudo, nil}, {`(in|not|and|b-and|or|b-or|b-xor|isif|elseif|else|importconstant|defined|divisibleby|empty|even|iterable|odd|sameasmatches|starts\s+with|ends\s+with)\b`, Keyword, nil}, {`(loop|block|parent)\b`, NameBuiltin, nil}, {`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*`, NameVariable, nil}, {`\.(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*`, NameVariable, nil}, {`\.[0-9]+`, LiteralNumber, nil}, {`:?"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, {`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {`([{}()\[\]+\-*/,:~%]|\.\.|\?|:|\*\*|\/\/|!=|[><=]=?)`, Operator, nil}, {`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil}, }, "var": { {`\s+`, Text, nil}, {`(-?)(\}\})`, ByGroups(Text, CommentPreproc), Pop(1)}, Include("varnames"), }, "tag": { {`\s+`, Text, nil}, {`(-?)(%\})`, ByGroups(Text, CommentPreproc), Pop(1)}, Include("varnames"), {`.`, Punctuation, nil}, }, }, ))
Twig lexer.
View Source
var TypeScript = internal.Register(MustNewLexer( &Config{ Name: "TypeScript", Aliases: []string{"ts", "typescript"}, Filenames: []string{"*.ts", "*.tsx"}, MimeTypes: []string{"text/x-typescript"}, DotAll: true, }, Rules{ "commentsandwhitespace": { {`\s+`, Text, nil}, {`<!--`, Comment, nil}, {`//.*?\n`, CommentSingle, nil}, {`/\*.*?\*/`, CommentMultiline, nil}, }, "slashstartsregex": { Include("commentsandwhitespace"), {`/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)`, LiteralStringRegex, Pop(1)}, {`(?=/)`, Text, Push("#pop", "badregex")}, Default(Pop(1)), }, "badregex": { {`\n`, Text, Pop(1)}, }, "root": { {`^(?=\s|/|<!--)`, Text, Push("slashstartsregex")}, Include("commentsandwhitespace"), {`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")}, {`[{(\[;,]`, Punctuation, Push("slashstartsregex")}, {`[})\].]`, Punctuation, nil}, {`(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|this)\b`, Keyword, Push("slashstartsregex")}, {`(var|let|with|function)\b`, KeywordDeclaration, Push("slashstartsregex")}, {`(abstract|boolean|byte|char|class|const|debugger|double|enum|export|extends|final|float|goto|implements|import|int|interface|long|native|package|private|protected|public|short|static|super|synchronized|throws|transient|volatile)\b`, KeywordReserved, nil}, {`(true|false|null|NaN|Infinity|undefined)\b`, KeywordConstant, nil}, {`(Array|Boolean|Date|Error|Function|Math|netscape|Number|Object|Packages|RegExp|String|sun|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b`, NameBuiltin, nil}, {`\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)`, ByGroups(KeywordReserved, Text, NameOther, Text), Push("slashstartsregex")}, {`\b(string|bool|number)\b`, KeywordType, nil}, {`\b(constructor|declare|interface|as|AS)\b`, KeywordReserved, nil}, {`(super)(\s*)(\([\w,?.$\s]+\s*\))`, ByGroups(KeywordReserved, Text), Push("slashstartsregex")}, {`([a-zA-Z_?.$][\w?.$]*)\(\) \{`, NameOther, Push("slashstartsregex")}, {`([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)`, ByGroups(NameOther, Text, KeywordType), nil}, {`[$a-zA-Z_]\w*`, NameOther, nil}, {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, {`[0-9]+`, LiteralNumberInteger, nil}, {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {"`", LiteralStringBacktick, Push("interp")}, {`@\w+`, KeywordDeclaration, nil}, }, "interp": { {"`", LiteralStringBacktick, Pop(1)}, {`\\\\`, LiteralStringBacktick, nil}, {"\\\\`", LiteralStringBacktick, nil}, {`\$\{`, LiteralStringInterpol, Push("interp-inside")}, {`\$`, LiteralStringBacktick, nil}, {"[^`\\\\$]+", LiteralStringBacktick, nil}, }, "interp-inside": { {`\}`, LiteralStringInterpol, Pop(1)}, Include("root"), }, }, ))
TypeScript lexer.
View Source
var TypoScriptCSSData = internal.Register(MustNewLexer( &Config{ Name: "TypoScriptCssData", Aliases: []string{"typoscriptcssdata"}, Filenames: []string{}, MimeTypes: []string{}, }, Rules{ "root": { {`(.*)(###\w+###)(.*)`, ByGroups(LiteralString, NameConstant, LiteralString), nil}, {`(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, Operator, NameConstant, NameConstant, LiteralStringSymbol), nil}, {`(.*)(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})(.*)`, ByGroups(LiteralString, LiteralStringSymbol, NameConstant, Operator, NameConstant, LiteralStringSymbol, LiteralString), nil}, {`\s+`, Text, nil}, {`/\*(?:(?!\*/).)*\*/`, Comment, nil}, {`(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)`, Comment, nil}, {`[<>,:=.*%+|]`, LiteralString, nil}, {`[\w"\-!/&;(){}]+`, LiteralString, nil}, }, }, ))
TypoScriptCSSData lexer.
View Source
var TypoScriptHTMLData = internal.Register(MustNewLexer( &Config{ Name: "TypoScriptHtmlData", Aliases: []string{"typoscripthtmldata"}, Filenames: []string{}, MimeTypes: []string{}, }, Rules{ "root": { {`(INCLUDE_TYPOSCRIPT)`, NameClass, nil}, {`(EXT|FILE|LLL):[^}\n"]*`, LiteralString, nil}, {`(.*)(###\w+###)(.*)`, ByGroups(LiteralString, NameConstant, LiteralString), nil}, {`(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, Operator, NameConstant, NameConstant, LiteralStringSymbol), nil}, {`(.*)(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})(.*)`, ByGroups(LiteralString, LiteralStringSymbol, NameConstant, Operator, NameConstant, LiteralStringSymbol, LiteralString), nil}, {`\s+`, Text, nil}, {`[<>,:=.*%+|]`, LiteralString, nil}, {`[\w"\-!/&;(){}#]+`, LiteralString, nil}, }, }, ))
TypoScriptHTMLData lexer.
View Source
var Typoscript = internal.Register(MustNewLexer( &Config{ Name: "TypoScript", Aliases: []string{"typoscript"}, Filenames: []string{"*.ts", "*.txt"}, MimeTypes: []string{"text/x-typoscript"}, DotAll: true, }, Rules{ "root": { Include("comment"), Include("constant"), Include("html"), Include("label"), Include("whitespace"), Include("keywords"), Include("punctuation"), Include("operator"), Include("structure"), Include("literal"), Include("other"), }, "keywords": { {`(\[)(?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(LiteralStringSymbol, NameConstant, Text, LiteralStringSymbol), nil}, {`(?=[\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\-])`, NameFunction, nil}, {`(?:(=?\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(Operator, NameBuiltin), nil}, {`(?=[\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\-])`, NameClass, nil}, {`(?=[\w\-])(ACTIFSUBRO|ACTIFSUB|ACTRO|ACT|CURIFSUBRO|CURIFSUB|CURRO|CUR|IFSUBRO|IFSUB|NO|SPC|USERDEF1RO|USERDEF1|USERDEF2RO|USERDEF2|USRRO|USR)`, NameClass, nil}, {`(?=[\w\-])(GMENU_FOLDOUT|GMENU_LAYERS|GMENU|IMGMENUITEM|IMGMENU|JSMENUITEM|JSMENU|TMENUITEM|TMENU_LAYERS|TMENU)`, NameClass, nil}, {`(?=[\w\-])(PHP_SCRIPT(_EXT|_INT)?)`, NameClass, nil}, {`(?=[\w\-])(userFunc)(?![\w\-])`, NameFunction, nil}, }, "whitespace": { {`\s+`, Text, nil}, }, "html": { {`<\S[^\n>]*>`, Using(TypoScriptHTMLData), nil}, {`&[^;\n]*;`, LiteralString, nil}, {`(_CSS_DEFAULT_STYLE)(\s*)(\()(?s)(.*(?=\n\)))`, ByGroups(NameClass, Text, LiteralStringSymbol, Using(TypoScriptCSSData)), nil}, }, "literal": { {`0x[0-9A-Fa-f]+t?`, LiteralNumberHex, nil}, {`[0-9]+`, LiteralNumberInteger, nil}, {`(###\w+###)`, NameConstant, nil}, }, "label": { {`(EXT|FILE|LLL):[^}\n"]*`, LiteralString, nil}, {`(?![^\w\-])([\w\-]+(?:/[\w\-]+)+/?)(\S*\n)`, ByGroups(LiteralString, LiteralString), nil}, }, "punctuation": { {`[,.]`, Punctuation, nil}, }, "operator": { {`[<>,:=.*%+|]`, Operator, nil}, }, "structure": { {`[{}()\[\]\\]`, LiteralStringSymbol, nil}, }, "constant": { {`(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, Operator, NameConstant, NameConstant, LiteralStringSymbol), nil}, {`(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, NameConstant, Operator, NameConstant, LiteralStringSymbol), nil}, {`(#[a-fA-F0-9]{6}\b|#[a-fA-F0-9]{3}\b)`, LiteralStringChar, nil}, }, "comment": { {`(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)`, Comment, nil}, {`/\*(?:(?!\*/).)*\*/`, Comment, nil}, {`(\s*#\s*\n)`, Comment, nil}, }, "other": { {`[\w"\-!/&;]+`, Text, nil}, }, }, ))
Typoscript lexer.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.