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

Commit

Permalink
Do not tokenize equal signs within strings
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Feb 26, 2019
1 parent 28ce891 commit ecae330
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grammars/toml.cson
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'2': 'name': 'keyword.operator.assignment.toml'
}
{
'match': '((")(.*)("))\\s*(=)' # This one is .* because " can be escaped
'match': '^((")(.*?)("))\\s*(=)' # This one is .* because " can be escaped
'captures':
'1': 'name': 'string.quoted.double.toml'
'2': 'name': 'punctuation.definition.string.begin.toml'
Expand Down
4 changes: 4 additions & 0 deletions spec/toml-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ describe "TOML grammar", ->
expect(tokens[1]).toEqual value: 'Equal sign ahead = no problem', scopes: ["source.toml", "string.quoted.double.toml"]
expect(tokens[2]).toEqual value: '"', scopes: ["source.toml", "string.quoted.double.toml", "punctuation.definition.string.end.toml"]

it "does not tokenize equal signs within strings", ->
{tokens} = grammar.tokenizeLine('pywinusb = { version = "*", os_name = "==\'nt\'", index="pypi"}')
expect(tokens[17]).toEqual value: "=='nt'", scopes: ["source.toml", "string.quoted.double.toml"]

it "tokenizes multiline strings", ->
lines = grammar.tokenizeLines '''
"""
Expand Down

0 comments on commit ecae330

Please sign in to comment.