From ad4890cd42e82fd0ce3c20dd4255c0c1256eb641 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Thu, 28 Sep 2017 00:26:19 +0200 Subject: [PATCH] Do not attempt to match newline characters --- grammars/pixie.cson | 16 ++++++---------- spec/grammar-spec.coffee | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/grammars/pixie.cson b/grammars/pixie.cson index 8c8f4dc..0b12667 100644 --- a/grammars/pixie.cson +++ b/grammars/pixie.cson @@ -64,7 +64,7 @@ 'captures': '1': 'name': 'punctuation.definition.comment.pixie' - 'match': '(;).*$\\n?' + 'match': '(;).*$' 'name': 'comment.line.semicolon.pixie' 'constants': 'patterns': [ @@ -185,15 +185,13 @@ 'beginCaptures': '1': 'name': 'punctuation.section.expression.begin.pixie' - 'end': '(\\))(\\n)|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))' + 'end': '(\\))$|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))' 'endCaptures': '1': 'name': 'punctuation.section.expression.end.trailing.pixie' '2': - 'name': 'meta.after-expression.pixie' - '3': 'name': 'punctuation.section.expression.end.trailing.pixie' - '4': + '3': 'name': 'punctuation.section.expression.end.pixie' 'name': 'meta.quoted-expression.pixie' 'patterns': [ @@ -235,15 +233,13 @@ 'beginCaptures': '1': 'name': 'punctuation.section.expression.begin.pixie' - 'end': '(\\))(\\n)|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))' + 'end': '(\\))$|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))' 'endCaptures': '1': 'name': 'punctuation.section.expression.end.trailing.pixie' '2': - 'name': 'meta.after-expression.pixie' - '3': 'name': 'punctuation.section.expression.end.trailing.pixie' - '4': + '3': 'name': 'punctuation.section.expression.end.pixie' 'name': 'meta.expression.pixie' 'patterns': [ @@ -307,7 +303,7 @@ 'captures': '1': 'name': 'punctuation.definition.comment.shebang.pixie' - 'match': '^(\\#!).*$\\n?' + 'match': '^(\\#!).*$' 'name': 'comment.line.semicolon.pixie' 'string': 'begin': '(? # Entire expression on one line. {tokens} = grammar.tokenizeLine "#{startsWith}foo, bar#{endsWith}" - [start, mid..., end, after] = tokens + [start, mid..., end, whitespace] = tokens expect(start).toEqual value: startsWith, scopes: ["source.pixie", "meta.#{metaScope}.pixie", "punctuation.section.#{puncScope}.begin.pixie"] expect(end).toEqual value: endsWith, scopes: ["source.pixie", "meta.#{metaScope}.pixie", "punctuation.section.#{puncScope}.end.trailing.pixie"] @@ -156,14 +156,14 @@ describe "Pixie grammar", -> # Expression broken over multiple lines. tokens = grammar.tokenizeLines("#{startsWith}foo\n bar#{endsWith}") - [start, mid..., after] = tokens[0] + [start, mid...] = tokens[0] expect(start).toEqual value: startsWith, scopes: ["source.pixie", "meta.#{metaScope}.pixie", "punctuation.section.#{puncScope}.begin.pixie"] for token in mid expect(token.scopes.slice(0, 2)).toEqual ["source.pixie", "meta.#{metaScope}.pixie"] - [mid..., end, after] = tokens[1] + [mid..., end] = tokens[1] expect(end).toEqual value: endsWith, scopes: ["source.pixie", "meta.#{metaScope}.pixie", "punctuation.section.#{puncScope}.end.trailing.pixie"]