Skip to content

Commit

Permalink
[SQL] Scope consistency (#2768)
Browse files Browse the repository at this point in the history
* [SQL] Scope consistency

This commit...

1. scopes `*` `variable.language.wildcard.asterisk` for consistency with
   Java and Makefile
2. scopes `||` as `keyword.operator.concatenation` for consistency with
   Lua, D [and Perl].
3. renames `keyword.operator.math` to `keyword.operator.arithmetic` to
   comply with scope naming guidelines.

* [PHP] Fix syntax tests due to new SQL scopes
  • Loading branch information
deathaxe committed Apr 8, 2021
1 parent 1c712d5 commit df13286
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions PHP/tests/syntax_test_php.php
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ function generate2()
SELECT * FROM users WHERE first_name = 'John' LIMIT $limit
//^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.sql source.sql
// <- keyword.other.DML
// ^ variable.language.star
// ^ variable.language.wildcard.asterisk
// ^^^^^^ string.quoted.single
// ^^^^^^ variable.other.php
SQL;
Expand All @@ -1798,7 +1798,7 @@ function generate2()
SELECT * FROM users WHERE first_name = 'John'\n
//^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.sql source.sql
// <- keyword.other.DML
// ^ variable.language.star
// ^ variable.language.wildcard.asterisk
// ^^^^^^ string.quoted.single
// ^^ - constant.character.escape.php
SQL;
Expand Down
6 changes: 3 additions & 3 deletions SQL/SQL.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ contexts:
- match: (?i)\b(asc|desc)\b
scope: keyword.other.order.sql
- match: \*
scope: variable.language.star.sql
scope: variable.language.wildcard.asterisk.sql
- match: "<=>|[!<>]?=|<>|<|>"
scope: keyword.operator.comparison.sql
- match: '-|\+|/'
scope: keyword.operator.math.sql
scope: keyword.operator.arithmetic.sql
- match: \|\|
scope: keyword.operator.concatenator.sql
scope: keyword.operator.concatenation.sql
- match: (?i)\b(CURRENT_(DATE|TIME(STAMP)?|USER)|(SESSION|SYSTEM)_USER)\b
comment: List of SQL99 built-in functions from http://www.oreilly.com/catalog/sqlnut/chapter/ch04.html
scope: support.function.scalar.sql
Expand Down
2 changes: 1 addition & 1 deletion SQL/syntax_test_sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ select

SELECT *,
-- ^^^ keyword.other.DML.sql
-- ^ variable.language.star.sql
-- ^ variable.language.wildcard.asterisk.sql
f.id AS database_id
-- ^^ keyword.operator.assignment.alias.sql
FROM foo
Expand Down

0 comments on commit df13286

Please sign in to comment.