Skip to content

Commit

Permalink
Improve boolean highlighting. Closes: #4
Browse files Browse the repository at this point in the history
  • Loading branch information
m-novikov committed Apr 15, 2022
1 parent f6d7384 commit b63e81b
Show file tree
Hide file tree
Showing 7 changed files with 12,080 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 b63e81b

Please sign in to comment.