From a41fc1421a91f91cc788fd21d74ffc915b7d5728 Mon Sep 17 00:00:00 2001 From: Caleb Doxsey Date: Sun, 7 Apr 2019 12:56:16 -0600 Subject: [PATCH] fixes #2423, allow no space before comment, do not allow double slash in unqouted string --- syntaxes/go.mod.tmGrammar.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/syntaxes/go.mod.tmGrammar.json b/syntaxes/go.mod.tmGrammar.json index 17af25a6b..37f29a45b 100644 --- a/syntaxes/go.mod.tmGrammar.json +++ b/syntaxes/go.mod.tmGrammar.json @@ -6,6 +6,9 @@ }, { "include": "#directive" + }, + { + "include": "#invalid" } ], "repository": { @@ -13,7 +16,7 @@ "patterns": [ { "comment": "Multi-Line directive", - "begin": "(\\w+)\\s+\\(", + "begin": "(\\w+)\\s*\\(", "beginCaptures": { "1": { "name": "keyword.go.mod" @@ -28,7 +31,7 @@ }, { "comment": "Single-Line directive", - "match": "(\\w+)\\s+(.*)", + "match": "(\\w+)\\s*(.*)", "captures": { "1": { "name": "keyword.go.mod" @@ -86,7 +89,7 @@ }, "unquoted_string": { "comment": "Unquoted string", - "match": "[^\\s]+", + "match": "([^\\s/]|/(?!/))+", "name": "string.unquoted.go.mod" }, "double_quoted_string": { @@ -158,6 +161,11 @@ "name": "constant.other.placeholder.go.mod" } ] + }, + "invalid": { + "comment": "invalid", + "match": ".*", + "name": "invalid.illegal.unknown.go.mod" } } -} \ No newline at end of file +}