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
@ -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},
|
||||||
|
@ -12,7 +12,7 @@ var SYSTEMD = internal.Register(MustNewLexer(
|
|||||||
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(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package v
|
package v
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -12,64 +11,63 @@ const vbName = `[_\w][\w]*`
|
|||||||
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