mirror of
https://github.com/alecthomas/chroma.git
synced 2025-01-14 02:23:16 +02:00
More YAML tweaks.
This commit is contained in:
parent
b25b614cb6
commit
b83a015e0b
@ -13,18 +13,26 @@ var YAML = Register(MustNewLexer(
|
|||||||
},
|
},
|
||||||
Rules{
|
Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Whitespace, nil},
|
Include("whitespace"),
|
||||||
{`#.*`, Comment, nil},
|
{`#.*`, Comment, nil},
|
||||||
{`!![^\s]+`, CommentPreproc, nil},
|
{`![^\s]+`, CommentPreproc, nil},
|
||||||
{`&[^\s]+`, CommentPreproc, nil},
|
{`\s&[^\s]+`, CommentPreproc, nil},
|
||||||
{`\*[^\s]+`, CommentPreproc, nil},
|
{`\s\*[^\s]+`, CommentPreproc, nil},
|
||||||
{Words(``, `\b`, "true", "false", "null"), KeywordConstant, nil},
|
{`^%include\s+[^\n\r]+`, CommentPreproc, nil},
|
||||||
{`"(?:\\.|[^"])+"`, StringDouble, nil},
|
|
||||||
{`\d\d\d\d-\d\d-\d\d([T ]\d\d:\d\d:\d\d(\.\d+)?(Z|\s+[-+]\d+)?)?`, LiteralDate, nil},
|
|
||||||
{`([>|])(\s+)((?:(?:.*?$)(?:[\n\r]*?\2)?)*)`, ByGroups(StringDoc, StringDoc, StringDoc), nil},
|
{`([>|])(\s+)((?:(?:.*?$)(?:[\n\r]*?\2)?)*)`, ByGroups(StringDoc, StringDoc, StringDoc), nil},
|
||||||
{`[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)\b`, Number, nil},
|
Include("value"),
|
||||||
{`[?:,\[\]]`, Punctuation, nil},
|
{`[?:,\[\]]`, Punctuation, nil},
|
||||||
{`.`, Text, nil},
|
{`.`, Text, nil},
|
||||||
},
|
},
|
||||||
|
"value": {
|
||||||
|
{Words(``, `\b`, "true", "false", "null"), KeywordConstant, nil},
|
||||||
|
{`"(?:\\.|[^"])*"`, StringDouble, nil},
|
||||||
|
{`'(?:\\.|[^'])*'`, StringSingle, nil},
|
||||||
|
{`\d\d\d\d-\d\d-\d\d([T ]\d\d:\d\d:\d\d(\.\d+)?(Z|\s+[-+]\d+)?)?`, LiteralDate, nil},
|
||||||
|
{`\b[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)\b`, Number, nil},
|
||||||
|
},
|
||||||
|
"whitespace": {
|
||||||
|
{`\s+`, Whitespace, nil},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user