Skip to content

Commit

Permalink
yaml parse --- and ... as NameNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
yaythomas authored and alecthomas committed May 11, 2020
1 parent 0d4fb38 commit 705c61c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lexers/testdata/yaml.expected
@@ -1,5 +1,5 @@
[
{"type":"Text","value":"---"},
{"type":"NameNamespace","value":"---"},
{"type":"TextWhitespace","value":" "},
{"type":"Comment","value":"# document start"},
{"type":"TextWhitespace","value":"\n\n"},
Expand Down Expand Up @@ -642,7 +642,7 @@
{"type":"TextWhitespace","value":" "},
{"type":"KeywordConstant","value":"null"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"Text","value":"..."},
{"type":"NameNamespace","value":"..."},
{"type":"TextWhitespace","value":" "},
{"type":"Comment","value":"# document end"},
{"type":"TextWhitespace","value":"\n"}
Expand Down
3 changes: 2 additions & 1 deletion lexers/y/yaml.go
Expand Up @@ -15,7 +15,8 @@ var YAML = internal.Register(MustNewLexer(
Rules{
"root": {
Include("whitespace"),
{`^---`, Text, nil},
{`^---`, NameNamespace, nil},
{`^\.\.\.`, NameNamespace, nil},
{`[\n?]?\s*- `, Text, nil},
{`#.*$`, Comment, nil},
{`!![^\s]+`, CommentPreproc, nil},
Expand Down

0 comments on commit 705c61c

Please sign in to comment.