Skip to content

Commit

Permalink
[SQL] Exclude prototype from more contexts (#4100)
Browse files Browse the repository at this point in the history
This commit excludes `prototype` from various contexts which expect special
tokens. It's unlikely or even unwanted to match arbitrary patterns there.
It finally saves a couple of bytes in compiled inherited syntaxes.
  • Loading branch information
deathaxe authored Nov 24, 2024
1 parent 112420e commit 65bf9f0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SQL/MySQL.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,7 @@ contexts:
###[ LIKE EXPRESSIONS ]########################################################

like-string-not-followed-by-escape:
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.string.begin.sql
set:
Expand All @@ -1667,6 +1668,7 @@ contexts:
- include: else-pop

like-escape-character-slash:
- meta_include_prototype: false
- match: (\')(\\\\)(\')
scope: meta.string.escape.sql string.quoted.single.sql
captures:
Expand Down
1 change: 1 addition & 0 deletions SQL/PostgreSQL.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ contexts:
push: expect-regexp

expect-regexp:
- meta_include_prototype: false
- match: \'
scope: meta.string.regexp.psql punctuation.definition.string.begin.psql
embed: scope:source.regexp
Expand Down
10 changes: 10 additions & 0 deletions SQL/SQL (basic).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@ contexts:
- like-string-followed-by-unknown-escape

like-string-not-followed-by-escape:
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.string.begin.sql
set:
Expand All @@ -1465,6 +1466,7 @@ contexts:
- include: else-pop

like-string-followed-by-escape-slash:
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.string.begin.sql
set:
Expand All @@ -1474,6 +1476,7 @@ contexts:
- include: else-pop

like-string-followed-by-escape-caret:
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.string.begin.sql
set:
Expand All @@ -1483,6 +1486,7 @@ contexts:
- include: else-pop

like-string-followed-by-escape-hash:
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.string.begin.sql
set:
Expand All @@ -1492,6 +1496,7 @@ contexts:
- include: else-pop

like-string-followed-by-unknown-escape:
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.string.begin.sql
set:
Expand Down Expand Up @@ -1548,6 +1553,7 @@ contexts:
- include: else-pop

like-escape-character-any:
- meta_include_prototype: false
- match: (\')([^'])(\')
scope: meta.string.escape.sql string.quoted.single.sql
captures:
Expand All @@ -1558,6 +1564,7 @@ contexts:
- include: else-pop

like-escape-character-caret:
- meta_include_prototype: false
- match: (\')(\^)(\')
scope: meta.string.escape.sql string.quoted.single.sql
captures:
Expand All @@ -1568,6 +1575,7 @@ contexts:
- include: like-else-fail

like-escape-character-slash:
- meta_include_prototype: false
- match: (\')(\\)(\')
scope: meta.string.escape.sql string.quoted.single.sql
captures:
Expand All @@ -1578,6 +1586,7 @@ contexts:
- include: like-else-fail

like-escape-character-hash:
- meta_include_prototype: false
- match: (\')(#)(\')
scope: meta.string.escape.sql string.quoted.single.sql
captures:
Expand All @@ -1600,6 +1609,7 @@ contexts:
- include: logical-operators

maybe-operator:
- meta_include_prototype: false
- match: '<=>|[!<>]?=|<>|<|>'
scope: keyword.operator.comparison.sql
pop: 1
Expand Down
1 change: 1 addition & 0 deletions SQL/TSQL.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ contexts:
scope: constant.language.tsql

###[ LIKE EXPRESSIONS ]########################################################

inside-like-single-quoted-string:
- meta_append: true
- match: |-
Expand Down

0 comments on commit 65bf9f0

Please sign in to comment.