mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-17 20:58:08 +02:00
Formatting.
This commit is contained in:
parent
3b3f74c6a5
commit
4eb0355de0
@ -22,8 +22,8 @@ var Ballerina = internal.Register(MustNewLexer(
|
|||||||
{`(break|catch|continue|done|else|finally|foreach|forever|fork|if|lock|match|return|throw|transaction|try|while)\b`, Keyword, nil},
|
{`(break|catch|continue|done|else|finally|foreach|forever|fork|if|lock|match|return|throw|transaction|try|while)\b`, Keyword, nil},
|
||||||
{`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
|
{`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
|
||||||
{`@[^\W\d][\w.]*`, NameDecorator, nil},
|
{`@[^\W\d][\w.]*`, NameDecorator, nil},
|
||||||
{`(annotation|bind|but|endpoint|error|function|object|private|public|returns|service|type|var|with|worker)\b`, KeywordDeclaration, nil},
|
{`(annotation|bind|but|endpoint|error|function|object|private|public|returns|service|type|var|with|worker)\b`, KeywordDeclaration, nil},
|
||||||
{`(boolean|byte|decimal|float|int|json|map|nil|record|string|table|xml)\b`, KeywordType, nil},
|
{`(boolean|byte|decimal|float|int|json|map|nil|record|string|table|xml)\b`, KeywordType, nil},
|
||||||
{`(true|false|null)\b`, KeywordConstant, nil},
|
{`(true|false|null)\b`, KeywordConstant, nil},
|
||||||
{`import(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")},
|
{`import(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")},
|
||||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package g
|
package g
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert"
|
"github.com/alecthomas/assert"
|
||||||
"github.com/alecthomas/chroma"
|
"github.com/alecthomas/chroma"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGoHTMLTemplateIssue126(t *testing.T) {
|
func TestGoHTMLTemplateIssue126(t *testing.T) {
|
||||||
for _, source := range []string{
|
for _, source := range []string{
|
||||||
`<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
`<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||||
<link>{{ .Permalink }}</link>
|
<link>{{ .Permalink }}</link>
|
||||||
@ -36,15 +36,15 @@ func TestGoHTMLTemplateIssue126(t *testing.T) {
|
|||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
`,
|
`,
|
||||||
`{{ $headless := .Site.GetPage "page" "some-headless-bundle" }}
|
`{{ $headless := .Site.GetPage "page" "some-headless-bundle" }}
|
||||||
{{ $reusablePages := $headless.Resources.Match "author*" }}
|
{{ $reusablePages := $headless.Resources.Match "author*" }}
|
||||||
<h2>Authors</h2>
|
<h2>Authors</h2>
|
||||||
{{ range $reusablePages }}
|
{{ range $reusablePages }}
|
||||||
<h3>{{ .Title }}</h3>
|
<h3>{{ .Title }}</h3>
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
{{ end }}`} {
|
{{ end }}`} {
|
||||||
tokens, err := chroma.Tokenise(GoHTMLTemplate, nil, source)
|
tokens, err := chroma.Tokenise(GoHTMLTemplate, nil, source)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, source, chroma.Stringify(tokens...))
|
assert.Equal(t, source, chroma.Stringify(tokens...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,9 @@ var Org = internal.Register(MustNewLexer(
|
|||||||
{`^(\*)( TODO)( .*)$`, ByGroups(GenericHeading, Error, GenericStrong), nil},
|
{`^(\*)( TODO)( .*)$`, ByGroups(GenericHeading, Error, GenericStrong), nil},
|
||||||
{`^(\*\*+)( TODO)( .*)$`, ByGroups(GenericSubheading, Error, Text), nil},
|
{`^(\*\*+)( TODO)( .*)$`, ByGroups(GenericSubheading, Error, Text), nil},
|
||||||
{`^(\*)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericHeading, GenericStrong, GenericEmph), nil}, // Level 1 heading with tags
|
{`^(\*)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericHeading, GenericStrong, GenericEmph), nil}, // Level 1 heading with tags
|
||||||
{`^(\*)( .+)$`, ByGroups(GenericHeading, GenericStrong), nil}, // // Level 1 heading with NO 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
|
{`^(\*\*+)( .+?)( :[a-zA-Z0-9_@:]+:)$`, ByGroups(GenericSubheading, Text, GenericEmph), nil}, // Level 2+ heading with tags
|
||||||
{`^(\*\*+)( .+)$`, ByGroups(GenericSubheading, Text), nil}, // Level 2+ heading with NO tags
|
{`^(\*\*+)( .+)$`, ByGroups(GenericSubheading, Text), nil}, // Level 2+ heading with NO tags
|
||||||
// Checkbox lists
|
// Checkbox lists
|
||||||
{`^( *)([+-] )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil},
|
{`^( *)([+-] )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil},
|
||||||
{`^( +)(\* )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil},
|
{`^( +)(\* )(\[[ X]\])( .+)$`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil},
|
||||||
@ -78,19 +78,19 @@ var Org = internal.Register(MustNewLexer(
|
|||||||
Include("inline"),
|
Include("inline"),
|
||||||
},
|
},
|
||||||
"inline": {
|
"inline": {
|
||||||
{`(\s)*(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))`, ByGroups(Text, GenericStrong, Text), nil}, // Bold
|
{`(\s)*(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))`, ByGroups(Text, GenericStrong, Text), nil}, // Bold
|
||||||
{`(\s)*(/[^/]+?/)((?=\W|\n|$))`, ByGroups(Text, GenericEmph, Text), nil}, // Italic
|
{`(\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}, // Verbatim
|
||||||
{`(\s)*(~[^\n~]+?~)((?=\W|\n|$))`, ByGroups(Text, NameClass, Text), nil}, // Code
|
{`(\s)*(~[^\n~]+?~)((?=\W|\n|$))`, ByGroups(Text, NameClass, Text), nil}, // Code
|
||||||
{`(\s)*(\+[^+]+?\+)((?=\W|\n|$))`, ByGroups(Text, GenericDeleted, Text), nil}, // Strikethrough
|
{`(\s)*(\+[^+]+?\+)((?=\W|\n|$))`, ByGroups(Text, GenericDeleted, Text), nil}, // Strikethrough
|
||||||
{`(\s)*(_[^_]+?_)((?=\W|\n|$))`, ByGroups(Text, GenericUnderline, Text), nil}, // Underline
|
{`(\s)*(_[^_]+?_)((?=\W|\n|$))`, ByGroups(Text, GenericUnderline, Text), nil}, // Underline
|
||||||
{`(<)([^<>]+?)(>)`, ByGroups(Text, String, Text), nil}, // <datestamp>
|
{`(<)([^<>]+?)(>)`, ByGroups(Text, String, Text), nil}, // <datestamp>
|
||||||
{`[{]{3}[^}]+[}]{3}`, NameBuiltin, nil}, // {{{macro(foo,1)}}}
|
{`[{]{3}[^}]+[}]{3}`, NameBuiltin, nil}, // {{{macro(foo,1)}}}
|
||||||
{`([^[])(\[fn:)([^]]+?)(\])([^]])`, ByGroups(Text, NameBuiltinPseudo, LiteralString, NameBuiltinPseudo, Text), nil}, // [fn:1]
|
{`([^[])(\[fn:)([^]]+?)(\])([^]])`, ByGroups(Text, NameBuiltinPseudo, LiteralString, NameBuiltinPseudo, Text), nil}, // [fn:1]
|
||||||
// Links
|
// Links
|
||||||
{`(\[\[)([^][]+?)(\]\[)([^][]+)(\]\])`, ByGroups(Text, NameAttribute, Text, NameTag, Text), nil}, // [[link][descr]]
|
{`(\[\[)([^][]+?)(\]\[)([^][]+)(\]\])`, ByGroups(Text, NameAttribute, Text, NameTag, Text), nil}, // [[link][descr]]
|
||||||
{`(\[\[)([^][]+?)(\]\])`, ByGroups(Text, NameAttribute, Text), nil}, // [[link]]
|
{`(\[\[)([^][]+?)(\]\])`, ByGroups(Text, NameAttribute, Text), nil}, // [[link]]
|
||||||
{`(<<)([^<>]+?)(>>)`, ByGroups(Text, NameAttribute, Text), nil}, // <<targetlink>>
|
{`(<<)([^<>]+?)(>>)`, ByGroups(Text, NameAttribute, Text), nil}, // <<targetlink>>
|
||||||
// Tables
|
// Tables
|
||||||
{`^( *)(\|[ -].*?[ -]\|)$`, ByGroups(Text, String), nil},
|
{`^( *)(\|[ -].*?[ -]\|)$`, ByGroups(Text, String), nil},
|
||||||
// Blank lines, newlines
|
// Blank lines, newlines
|
||||||
|
@ -15,13 +15,13 @@ var Sass = internal.Register(MustNewLexer(
|
|||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
Rules{
|
||||||
|
// "root": {
|
||||||
|
// },
|
||||||
"root": {
|
"root": {
|
||||||
{`[ \t]*\n`, Text, nil},
|
{`[ \t]*\n`, Text, nil},
|
||||||
// { `[ \t]*`, ?? <function _indentation at 0x10fcaf1e0> ??, nil },
|
// { `[ \t]*`, ?? <function _indentation at 0x106932e18> ??, nil },
|
||||||
},
|
// { `//[^\n]*`, ?? <function _starts_block.<locals>.callback at 0x106936048> ??, Push("root") },
|
||||||
"content": {
|
// { `/\*[^\n]*`, ?? <function _starts_block.<locals>.callback at 0x1069360d0> ??, Push("root") },
|
||||||
// { `//[^\n]*`, ?? <function _starts_block.<locals>.callback at 0x10fcaf378> ??, Push("root") },
|
|
||||||
// { `/\*[^\n]*`, ?? <function _starts_block.<locals>.callback at 0x10fcaf400> ??, Push("root") },
|
|
||||||
{`@import`, Keyword, Push("import")},
|
{`@import`, Keyword, Push("import")},
|
||||||
{`@for`, Keyword, Push("for")},
|
{`@for`, Keyword, Push("for")},
|
||||||
{`@(debug|warn|if|while)`, Keyword, Push("value")},
|
{`@(debug|warn|if|while)`, Keyword, Push("value")},
|
||||||
@ -112,9 +112,9 @@ var Sass = internal.Register(MustNewLexer(
|
|||||||
{`"`, LiteralStringDouble, Pop(1)},
|
{`"`, LiteralStringDouble, Pop(1)},
|
||||||
},
|
},
|
||||||
"string-single": {
|
"string-single": {
|
||||||
{`(\\.|#(?=[^\n{])|[^\n'#])+`, LiteralStringDouble, nil},
|
{`(\\.|#(?=[^\n{])|[^\n'#])+`, LiteralStringSingle, nil},
|
||||||
{`#\{`, LiteralStringInterpol, Push("interpolation")},
|
{`#\{`, LiteralStringInterpol, Push("interpolation")},
|
||||||
{`'`, LiteralStringDouble, Pop(1)},
|
{`'`, LiteralStringSingle, Pop(1)},
|
||||||
},
|
},
|
||||||
"string-url": {
|
"string-url": {
|
||||||
{`(\\#|#(?=[^\n{])|[^\n#)])+`, LiteralStringOther, nil},
|
{`(\\#|#(?=[^\n{])|[^\n#)])+`, LiteralStringOther, nil},
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
|
|
||||||
var SYSTEMD = internal.Register(MustNewLexer(
|
var SYSTEMD = internal.Register(MustNewLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "SYSTEMD",
|
Name: "SYSTEMD",
|
||||||
Aliases: []string{"systemd"},
|
Aliases: []string{"systemd"},
|
||||||
Filenames: []string{"*.service"},
|
Filenames: []string{"*.service"},
|
||||||
MimeTypes: []string{"text/plain"},
|
MimeTypes: []string{"text/plain"},
|
||||||
},
|
},
|
||||||
Rules {
|
Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`[;#].*`, Comment, nil},
|
{`[;#].*`, Comment, nil},
|
||||||
@ -26,4 +26,3 @@ var SYSTEMD = internal.Register(MustNewLexer(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
||||||
|
128
lexers/v/vb.go
128
lexers/v/vb.go
@ -1,75 +1,73 @@
|
|||||||
|
|
||||||
package v
|
package v
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/alecthomas/chroma" // nolint
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
"github.com/alecthomas/chroma/lexers/internal"
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
const vbName = `[_\w][\w]*`
|
const vbName = `[_\w][\w]*`
|
||||||
|
|
||||||
// VB.Net lexer.
|
// VB.Net lexer.
|
||||||
var VBNet = internal.Register(MustNewLexer(
|
var VBNet = internal.Register(MustNewLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "VB.net",
|
Name: "VB.net",
|
||||||
Aliases: []string{ "vb.net", "vbnet", },
|
Aliases: []string{"vb.net", "vbnet"},
|
||||||
Filenames: []string{ "*.vb", "*.bas", },
|
Filenames: []string{"*.vb", "*.bas"},
|
||||||
MimeTypes: []string{ "text/x-vbnet", "text/x-vba", },
|
MimeTypes: []string{"text/x-vbnet", "text/x-vba"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{ `^\s*<.*?>`, NameAttribute, nil },
|
{`^\s*<.*?>`, NameAttribute, nil},
|
||||||
{ `\s+`, Text, nil },
|
{`\s+`, Text, nil},
|
||||||
{ `\n`, Text, nil },
|
{`\n`, Text, nil},
|
||||||
{ `rem\b.*?\n`, Comment, nil },
|
{`rem\b.*?\n`, Comment, nil},
|
||||||
{ `'.*?\n`, Comment, nil },
|
{`'.*?\n`, Comment, nil},
|
||||||
{ `#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|#ExternalSource.*?\n|#End\s+ExternalSource|#Region.*?\n|#End\s+Region|#ExternalChecksum`, CommentPreproc, nil },
|
{`#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|#ExternalSource.*?\n|#End\s+ExternalSource|#Region.*?\n|#End\s+Region|#ExternalChecksum`, CommentPreproc, nil},
|
||||||
{ `[(){}!#,.:]`, Punctuation, nil },
|
{`[(){}!#,.:]`, Punctuation, nil},
|
||||||
{ `Option\s+(Strict|Explicit|Compare)\s+(On|Off|Binary|Text)`, KeywordDeclaration, nil },
|
{`Option\s+(Strict|Explicit|Compare)\s+(On|Off|Binary|Text)`, KeywordDeclaration, nil},
|
||||||
{ Words(`(?<!\.)`, `\b`, `AddHandler`, `Alias`, `ByRef`, `ByVal`, `Call`, `Case`, `Catch`, `CBool`, `CByte`, `CChar`, `CDate`, `CDec`, `CDbl`, `CInt`, `CLng`, `CObj`, `Continue`, `CSByte`, `CShort`, `CSng`, `CStr`, `CType`, `CUInt`, `CULng`, `CUShort`, `Declare`, `Default`, `Delegate`, `DirectCast`, `Do`, `Each`, `Else`, `ElseIf`, `EndIf`, `Erase`, `Error`, `Event`, `Exit`, `False`, `Finally`, `For`, `Friend`, `Get`, `Global`, `GoSub`, `GoTo`, `Handles`, `If`, `Implements`, `Inherits`, `Interface`, `Let`, `Lib`, `Loop`, `Me`, `MustInherit`, `MustOverride`, `MyBase`, `MyClass`, `Narrowing`, `New`, `Next`, `Not`, `Nothing`, `NotInheritable`, `NotOverridable`, `Of`, `On`, `Operator`, `Option`, `Optional`, `Overloads`, `Overridable`, `Overrides`, `ParamArray`, `Partial`, `Private`, `Protected`, `Public`, `RaiseEvent`, `ReadOnly`, `ReDim`, `RemoveHandler`, `Resume`, `Return`, `Select`, `Set`, `Shadows`, `Shared`, `Single`, `Static`, `Step`, `Stop`, `SyncLock`, `Then`, `Throw`, `To`, `True`, `Try`, `TryCast`, `Wend`, `Using`, `When`, `While`, `Widening`, `With`, `WithEvents`, `WriteOnly`), Keyword, nil },
|
{Words(`(?<!\.)`, `\b`, `AddHandler`, `Alias`, `ByRef`, `ByVal`, `Call`, `Case`, `Catch`, `CBool`, `CByte`, `CChar`, `CDate`, `CDec`, `CDbl`, `CInt`, `CLng`, `CObj`, `Continue`, `CSByte`, `CShort`, `CSng`, `CStr`, `CType`, `CUInt`, `CULng`, `CUShort`, `Declare`, `Default`, `Delegate`, `DirectCast`, `Do`, `Each`, `Else`, `ElseIf`, `EndIf`, `Erase`, `Error`, `Event`, `Exit`, `False`, `Finally`, `For`, `Friend`, `Get`, `Global`, `GoSub`, `GoTo`, `Handles`, `If`, `Implements`, `Inherits`, `Interface`, `Let`, `Lib`, `Loop`, `Me`, `MustInherit`, `MustOverride`, `MyBase`, `MyClass`, `Narrowing`, `New`, `Next`, `Not`, `Nothing`, `NotInheritable`, `NotOverridable`, `Of`, `On`, `Operator`, `Option`, `Optional`, `Overloads`, `Overridable`, `Overrides`, `ParamArray`, `Partial`, `Private`, `Protected`, `Public`, `RaiseEvent`, `ReadOnly`, `ReDim`, `RemoveHandler`, `Resume`, `Return`, `Select`, `Set`, `Shadows`, `Shared`, `Single`, `Static`, `Step`, `Stop`, `SyncLock`, `Then`, `Throw`, `To`, `True`, `Try`, `TryCast`, `Wend`, `Using`, `When`, `While`, `Widening`, `With`, `WithEvents`, `WriteOnly`), Keyword, nil},
|
||||||
{ `(?<!\.)End\b`, Keyword, Push("end") },
|
{`(?<!\.)End\b`, Keyword, Push("end")},
|
||||||
{ `(?<!\.)(Dim|Const)\b`, Keyword, Push("dim") },
|
{`(?<!\.)(Dim|Const)\b`, Keyword, Push("dim")},
|
||||||
{ `(?<!\.)(Function|Sub|Property)(\s+)`, ByGroups(Keyword, Text), Push("funcname") },
|
{`(?<!\.)(Function|Sub|Property)(\s+)`, ByGroups(Keyword, Text), Push("funcname")},
|
||||||
{ `(?<!\.)(Class|Structure|Enum)(\s+)`, ByGroups(Keyword, Text), Push("classname") },
|
{`(?<!\.)(Class|Structure|Enum)(\s+)`, ByGroups(Keyword, Text), Push("classname")},
|
||||||
{ `(?<!\.)(Module|Namespace|Imports)(\s+)`, ByGroups(Keyword, Text), Push("namespace") },
|
{`(?<!\.)(Module|Namespace|Imports)(\s+)`, ByGroups(Keyword, Text), Push("namespace")},
|
||||||
{ `(?<!\.)(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|Object|SByte|Short|Single|String|Variant|UInteger|ULong|UShort)\b`, KeywordType, nil },
|
{`(?<!\.)(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|Object|SByte|Short|Single|String|Variant|UInteger|ULong|UShort)\b`, KeywordType, nil},
|
||||||
{ `(?<!\.)(AddressOf|And|AndAlso|As|GetType|In|Is|IsNot|Like|Mod|Or|OrElse|TypeOf|Xor)\b`, OperatorWord, nil },
|
{`(?<!\.)(AddressOf|And|AndAlso|As|GetType|In|Is|IsNot|Like|Mod|Or|OrElse|TypeOf|Xor)\b`, OperatorWord, nil},
|
||||||
{ `&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|<=|>=|<>|[-&*/\\^+=<>\[\]]`, Operator, nil },
|
{`&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|<=|>=|<>|[-&*/\\^+=<>\[\]]`, Operator, nil},
|
||||||
{ `"`, LiteralString, Push("string") },
|
{`"`, LiteralString, Push("string")},
|
||||||
{ `_\n`, Text, nil },
|
{`_\n`, Text, nil},
|
||||||
{ vbName, Name, nil },
|
{vbName, Name, nil},
|
||||||
{ `#.*?#`, LiteralDate, nil },
|
{`#.*?#`, LiteralDate, nil},
|
||||||
{ `(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?`, LiteralNumberFloat, nil },
|
{`(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?`, LiteralNumberFloat, nil},
|
||||||
{ `\d+([SILDFR]|US|UI|UL)?`, LiteralNumberInteger, nil },
|
{`\d+([SILDFR]|US|UI|UL)?`, LiteralNumberInteger, nil},
|
||||||
{ `&H[0-9a-f]+([SILDFR]|US|UI|UL)?`, LiteralNumberInteger, nil },
|
{`&H[0-9a-f]+([SILDFR]|US|UI|UL)?`, LiteralNumberInteger, nil},
|
||||||
{ `&O[0-7]+([SILDFR]|US|UI|UL)?`, LiteralNumberInteger, nil },
|
{`&O[0-7]+([SILDFR]|US|UI|UL)?`, LiteralNumberInteger, nil},
|
||||||
},
|
},
|
||||||
"string": {
|
"string": {
|
||||||
{ `""`, LiteralString, nil },
|
{`""`, LiteralString, nil},
|
||||||
{ `"C?`, LiteralString, Pop(1) },
|
{`"C?`, LiteralString, Pop(1)},
|
||||||
{ `[^"]+`, LiteralString, nil },
|
{`[^"]+`, LiteralString, nil},
|
||||||
},
|
},
|
||||||
"dim": {
|
"dim": {
|
||||||
{ vbName, NameVariable, Pop(1) },
|
{vbName, NameVariable, Pop(1)},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
"funcname": {
|
"funcname": {
|
||||||
{ vbName, NameFunction, Pop(1) },
|
{vbName, NameFunction, Pop(1)},
|
||||||
},
|
},
|
||||||
"classname": {
|
"classname": {
|
||||||
{ vbName, NameClass, Pop(1) },
|
{vbName, NameClass, Pop(1)},
|
||||||
},
|
},
|
||||||
"namespace": {
|
"namespace": {
|
||||||
{ vbName, NameNamespace, nil },
|
{vbName, NameNamespace, nil},
|
||||||
{ `\.`, NameNamespace, nil },
|
{`\.`, NameNamespace, nil},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
{ `\s+`, Text, nil },
|
{`\s+`, Text, nil},
|
||||||
{ `(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b`, Keyword, Pop(1) },
|
{`(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b`, Keyword, Pop(1)},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user