Skip to content

Commit

Permalink
feat: sql grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
ravsii committed Nov 5, 2024
1 parent d306db3 commit 423cd05
Show file tree
Hide file tree
Showing 6 changed files with 2,179 additions and 1,761 deletions.
2 changes: 1 addition & 1 deletion Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module.exports = grammar({
$.label_codeblock,
repeat1($._label_base),
token(seq('"', /.*/, '"')),
seq('[', $._label_constraints, ']'),
)),

label_codeblock: $ => choice(
Expand All @@ -78,6 +79,9 @@ module.exports = grammar({

_label_codeblock_lang: _ => token(/[a-zA-Z]+/),
_label_codeblock_body: _ => repeat1(seq(/.+/, /\s*/)),
_label_constraints: $ => repeat1(seq($.label_constraint, optional(";"))),

label_constraint: _ => token(/[a-z_]+/),

_label_base: $ => choice(
$._ident_base,
Expand All @@ -98,7 +102,7 @@ module.exports = grammar({
optional($._fields),
)),
_fields: $ => r1seq(".", field("field", $.identifier)),
_ident: $ => seq($._ident_base, rseq(/[\s\-\'\_]+/, $._ident_base)),
_ident: $ => seq($._ident_base, rseq(/[\s\-\']+/, $._ident_base)),
_ident_base: _ => /[\p{L}\d\/\*\_]+/,

comment: _ => token(seq('#', /.*/)),
Expand Down
50 changes: 49 additions & 1 deletion src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 423cd05

Please sign in to comment.