Skip to content

Commit

Permalink
feat: connection references
Browse files Browse the repository at this point in the history
  • Loading branch information
ravsii committed Sep 29, 2024
1 parent 0a45480 commit 89b9d0a
Show file tree
Hide file tree
Showing 6 changed files with 4,061 additions and 456 deletions.
17 changes: 11 additions & 6 deletions grammar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const PREC = {
connection: 100,
conn_identifier: 90,
};

const newline = /\n/;
Expand All @@ -26,12 +27,16 @@ module.exports = grammar({
),

declaration: $ => seq(
optional("("),
field("identifier", $.identifier),
rseq(
field("connection", $.connection),
field("identifier", $.identifier),
),
optional(field("label", $.label)),
optional(")"),
optional(field("conn_identifier", $.connection_identifier)),
repeat(field("field", seq(".", $.field))),
repeat(field("label", $.label)),
terminator,
),

Expand All @@ -41,13 +46,13 @@ module.exports = grammar({
/-+>/,
/--+/,
))),
connection_identifier: _ => token(seq(
"[", /\d+/, "]",
)),
label: _ => seq(":", /.*/),

identifier: $ => choice(
$._ident,
seq($._ident, rseq(".", $.field))
),
field: $ => $._ident_base,
identifier: $ => $._ident,
field: $ => $._ident,

_ident: $ => seq($._ident_base, rseq(/[\s\-]+/, $._ident_base)),
_ident_base: _ => /[\p{L}\d\'_]+/,
Expand Down
115 changes: 80 additions & 35 deletions src/grammar.json

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

50 changes: 38 additions & 12 deletions 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 89b9d0a

Please sign in to comment.