diff --git a/grammars/python.cson b/grammars/python.cson index f17d339..68c1ee6 100644 --- a/grammars/python.cson +++ b/grammars/python.cson @@ -2226,7 +2226,7 @@ 'name': 'punctuation.definition.string.end.python' '2': 'name': 'invalid.illegal.unclosed-string.python' - 'name': 'string.quoted.single.single-line.python' + 'name': 'string.quoted.single.single-line.sql.python' 'contentName': 'meta.embedded.sql' 'patterns': [ { diff --git a/spec/python-spec.coffee b/spec/python-spec.coffee index 01c0258..55e47f6 100644 --- a/spec/python-spec.coffee +++ b/spec/python-spec.coffee @@ -771,28 +771,28 @@ describe "Python grammar", -> it "tokenizes SQL inline highlighting on single line with a CTE", -> {tokens} = grammar.tokenizeLine('\'WITH example_cte AS (SELECT bar FROM foo) SELECT COUNT(*) FROM example_cte\'') - expect(tokens[0]).toEqual value: '\'', scopes: ['source.python', 'string.quoted.single.single-line.python', 'punctuation.definition.string.begin.python'] - expect(tokens[1]).toEqual value: 'WITH', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] - expect(tokens[2]).toEqual value: ' example_cte ', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[3]).toEqual value: 'AS', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.other.alias.sql'] - expect(tokens[4]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[5]).toEqual value: '(', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.begin.sql'] - expect(tokens[6]).toEqual value: 'SELECT', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] - expect(tokens[7]).toEqual value: ' bar ', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[8]).toEqual value: 'FROM', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] - expect(tokens[9]).toEqual value: ' foo', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[10]).toEqual value: ')', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.end.sql'] - expect(tokens[11]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[12]).toEqual value: 'SELECT', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] - expect(tokens[13]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[14]).toEqual value: 'COUNT', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'support.function.aggregate.sql'] - expect(tokens[15]).toEqual value: '(', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.begin.sql'] - expect(tokens[16]).toEqual value: '*', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.operator.star.sql'] - expect(tokens[17]).toEqual value: ')', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.end.sql'] - expect(tokens[18]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[19]).toEqual value: 'FROM', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] - expect(tokens[20]).toEqual value: ' example_cte', scopes: ['source.python', 'string.quoted.single.single-line.python', 'meta.embedded.sql'] - expect(tokens[21]).toEqual value: '\'', scopes: ['source.python', 'string.quoted.single.single-line.python', 'punctuation.definition.string.end.python'] + expect(tokens[0]).toEqual value: '\'', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'punctuation.definition.string.begin.python'] + expect(tokens[1]).toEqual value: 'WITH', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] + expect(tokens[2]).toEqual value: ' example_cte ', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[3]).toEqual value: 'AS', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.other.alias.sql'] + expect(tokens[4]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[5]).toEqual value: '(', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.begin.sql'] + expect(tokens[6]).toEqual value: 'SELECT', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] + expect(tokens[7]).toEqual value: ' bar ', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[8]).toEqual value: 'FROM', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] + expect(tokens[9]).toEqual value: ' foo', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[10]).toEqual value: ')', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.end.sql'] + expect(tokens[11]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[12]).toEqual value: 'SELECT', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] + expect(tokens[13]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[14]).toEqual value: 'COUNT', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'support.function.aggregate.sql'] + expect(tokens[15]).toEqual value: '(', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.begin.sql'] + expect(tokens[16]).toEqual value: '*', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.operator.star.sql'] + expect(tokens[17]).toEqual value: ')', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.end.sql'] + expect(tokens[18]).toEqual value: ' ', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[19]).toEqual value: 'FROM', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql', 'keyword.other.DML.sql'] + expect(tokens[20]).toEqual value: ' example_cte', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'meta.embedded.sql'] + expect(tokens[21]).toEqual value: '\'', scopes: ['source.python', 'string.quoted.single.single-line.sql.python', 'punctuation.definition.string.end.python'] it "tokenizes Python escape characters and formatting specifiers in SQL strings", -> {tokens} = grammar.tokenizeLine('"INSERT INTO url (image_uri) VALUES (\\\'%s\\\');" % values')