Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt to match newline characters #1

Merged
merged 1 commit into from
Sep 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions grammars/pixie.cson
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'captures':
'1':
'name': 'punctuation.definition.comment.pixie'
'match': '(;).*$\\n?'
'match': '(;).*$'
'name': 'comment.line.semicolon.pixie'
'constants':
'patterns': [
Expand Down Expand Up @@ -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': [
Expand Down Expand Up @@ -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': [
Expand Down Expand Up @@ -307,7 +303,7 @@
'captures':
'1':
'name': 'punctuation.definition.comment.shebang.pixie'
'match': '^(\\#!).*$\\n?'
'match': '^(\\#!).*$'
'name': 'comment.line.semicolon.pixie'
'string':
'begin': '(?<!\\\\)(")'
Expand Down
6 changes: 3 additions & 3 deletions spec/grammar-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe "Pixie grammar", ->
# 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"]
Expand All @@ -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"]

Expand Down