Skip to content

Commit

Permalink
Merge pull request #5 from m-novikov/improve-boolean-hl
Browse files Browse the repository at this point in the history
Improve boolean highlighting. Closes: #4
  • Loading branch information
m-novikov authored Apr 15, 2022
2 parents 633ea8f + b63e81b commit 5d466d5
Show file tree
Hide file tree
Showing 6 changed files with 12,079 additions and 11,366 deletions.
1 change: 1 addition & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ module.exports = grammar({
distinct_from: $ => prec.left(seq(kw("DISTINCT FROM"), $._expression)),
boolean_expression: $ =>
choice(
prec.left(5, seq(kw("NOT"), $._expression)),
prec.left(4, seq($._expression, kw("AND"), $._expression)),
prec.left(3, seq($._expression, kw("OR"), $._expression)),
),
Expand Down
8 changes: 6 additions & 2 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
] @keyword

[
"AND"
"AS"
"CREATE"
"CREATE_DOMAIN"
Expand All @@ -77,20 +78,23 @@
"INNER"
"INSERT"
"INTO"
"IN"
"JOIN"
"LANGUAGE"
"LEFT"
"LOCAL"
"NOT"
"ON"
"OR"
"ORDER_BY"
"OUTER"
"PRIMARY_KEY"
"PUBLIC"
"RETURNS"
"SCHEMA"
"SELECT"
"SET"
"LOCAL"
"SESSION"
"SET"
"TABLE"
"TO"
"UNIQUE"
Expand Down
22 changes: 22 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3042,6 +3042,28 @@
"boolean_expression": {
"type": "CHOICE",
"members": [
{
"type": "PREC_LEFT",
"value": 5,
"content": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "[nN][oO][tT]"
},
"named": false,
"value": "NOT"
},
{
"type": "SYMBOL",
"name": "_expression"
}
]
}
},
{
"type": "PREC_LEFT",
"value": 4,
Expand Down
Loading

0 comments on commit 5d466d5

Please sign in to comment.