Skip to content

Commit

Permalink
[SQL] add boolean sub-scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Hall committed Jul 14, 2024
1 parent 827b729 commit 2242ce0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions SQL/Cassandra.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ contexts:

###[ LITERALS ]################################################################

constants:
- meta_prepend: true
- include: booleans

literals-and-variables:
- meta_prepend: true
- include: variables
Expand Down
1 change: 1 addition & 0 deletions SQL/MySQL.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ contexts:
scope: constant.language.sql

bool-constants:
- include: booleans
- match: \b(?i:yes|no)\b
scope: constant.language.boolean.sql

Expand Down
8 changes: 6 additions & 2 deletions SQL/SQL (basic).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1405,11 +1405,15 @@ contexts:
- include: strings

constants:
- match: \b(?i:true|false)\b
scope: constant.language.boolean.sql
- match: \b(?i:null)\b
scope: constant.language.null.sql

booleans:
- match: \b(?i:true)\b
scope: constant.language.boolean.true.sql
- match: \b(?i:false)\b
scope: constant.language.boolean.false.sql

numbers:
- match: \b\d+(\.)\d+\b
scope: meta.number.float.decimal.sql constant.numeric.value.sql
Expand Down
2 changes: 1 addition & 1 deletion SQL/tests/syntax/syntax_test_cassandra.cql
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ WITH HEADER=true;
-- ^ keyword.other
-- ^^^^^^ string.unquoted
-- ^ keyword.operator
-- ^^^^ constant.language.boolean
-- ^^^^ constant.language.boolean.true
-- ^ punctuation.terminator.statement

TRUNCATE table1;
Expand Down
6 changes: 4 additions & 2 deletions SQL/tests/syntax/syntax_test_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
-- ^ - constant
-- ^^^^ constant.language.null.sql
-- ^ - constant
-- ^^^^ constant.language.boolean.sql
-- ^^^^ constant.language.boolean.true.sql
-- ^ - constant
-- ^^^^^ constant.language.boolean.sql
-- ^^^^^ constant.language.boolean.false.sql
-- ^ - constant

all default maxvalue
Expand Down Expand Up @@ -1315,6 +1315,8 @@ create table fancy_table (
-- ^^^^^^^ storage.type.sql
myflag boolean DEFAULT false,
-- ^^^^^^^ storage.type.sql
-- ^^^^^^^ storage.modifier.sql
-- ^^^^^ constant.language.boolean.false.sql
mycount double precision DEFAULT 1,
-- ^^^^^^^^^^^^^^^^^ storage.type.sql
fancy_column character varying(42) DEFAULT 'nice'::character varying,
Expand Down

0 comments on commit 2242ce0

Please sign in to comment.