Skip to content

Commit bda9e6b

Browse files
authored
Add use_statement (#16)
1 parent e566dee commit bda9e6b

File tree

6 files changed

+60845
-60420
lines changed

6 files changed

+60845
-60420
lines changed

examples/use.surql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
USE NS test; -- Switch to the 'test' Namespace
2+
3+
USE DB test; -- Switch to the 'test' Database
4+
5+
USE NS test DB test; -- Switch to the 'test' Namespace and 'test' Database

grammar.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ module.exports = grammar({
217217
$.insert_statement,
218218
$.relate_statement,
219219
$.delete_statement,
220+
$.use_statement,
221+
),
222+
223+
use_statement: $ =>
224+
seq(
225+
$.keyword_use,
226+
choice($.ns_clause, $.db_clause, seq($.ns_clause, $.db_clause)),
220227
),
221228

222229
begin_statement: $ => seq($.keyword_begin, optional($.keyword_transaction)),
@@ -556,6 +563,9 @@ module.exports = grammar({
556563

557564
// Clauses
558565

566+
ns_clause: $ => seq($.keyword_ns, $.identifier),
567+
db_clause: $ => seq($.keyword_db, $.identifier),
568+
559569
select_clause: $ =>
560570
seq(
561571
$.keyword_select,

src/grammar.json

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)