Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix unified expression language single quote escape #125

Closed
Closed
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
2 changes: 1 addition & 1 deletion grammars/unified expression language (el).cson
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.java.el'
'end': '\''
'end': '(?<!\\\\)\''
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.java.el'
Expand Down
8 changes: 8 additions & 0 deletions spec/unified-el-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ describe 'Unified expression language grammar', ->
expect(tokens[5]).toEqual value: 'baz', scopes: ['source.java.el', 'string.quoted.single.java.el']
expect(tokens[6]).toEqual value: "'", scopes: ['source.java.el', 'string.quoted.single.java.el', 'punctuation.definition.string.end.java.el']

it 'tokenizes single quoted string literals with escaped single quote', ->
{tokens} = grammar.tokenizeLine "'foo \\\\\' bar'"
expect(tokens[0]).toEqual value: "'", scopes: ['source.java.el', 'string.quoted.single.java.el', 'punctuation.definition.string.begin.java.el']
expect(tokens[1]).toEqual value: 'foo ', scopes: ['source.java.el', 'string.quoted.single.java.el']
expect(tokens[2]).toEqual value: '\\\\', scopes: ['source.java.el', 'string.quoted.single.java.el', 'constant.character.escape.java.el']
expect(tokens[3]).toEqual value: '\' bar', scopes: ['source.java.el', 'string.quoted.single.java.el']
expect(tokens[4]).toEqual value: "'", scopes: ['source.java.el', 'string.quoted.single.java.el', 'punctuation.definition.string.end.java.el']

it 'tokenizes double quoted string literals', ->
{tokens} = grammar.tokenizeLine '"foo\\n bar \\\"baz"'
expect(tokens[0]).toEqual value: '"', scopes: ['source.java.el', 'string.quoted.double.java.el', 'punctuation.definition.string.begin.java.el']
Expand Down