Skip to content

Commit

Permalink
Add define_database
Browse files Browse the repository at this point in the history
  • Loading branch information
Ce11an committed Aug 25, 2024
1 parent 8595b76 commit 2a9103f
Show file tree
Hide file tree
Showing 6 changed files with 48,454 additions and 48,131 deletions.
11 changes: 11 additions & 0 deletions examples/define_database.surql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Define database
DEFINE DATABASE app_vitalsense;

-- Create a DATABASE if it does not already exist
DEFINE DATABASE IF NOT EXISTS app_vitalsense;

-- Create a DATABASE and overwrite if it already exists
DEFINE DATABASE OVERWRITE app_vitalsense;

-- Create a DATABASE and overwrite if it already exists with a comment
DEFINE DATABASE OVERWRITE app_vitalsense COMMENT "This is a comment";
10 changes: 10 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ module.exports = grammar({
$.cancel_statement,
$.commit_statement,
$.define_analyzer_statement,
$.define_database,
$.define_event_statement,
$.define_field_statement,
$.define_function_statement,
Expand Down Expand Up @@ -242,6 +243,15 @@ module.exports = grammar({
),
),

define_database: $ =>
seq(
$.keyword_define,
$.keyword_database,
optional(choice($.if_not_exists_clause, $.keyword_overwrite)),
$.identifier,
optional($.comment_clause),
),

define_event_statement: $ =>
seq(
$.keyword_define,
Expand Down
54 changes: 54 additions & 0 deletions src/grammar.json

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

39 changes: 39 additions & 0 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 2a9103f

Please sign in to comment.