Skip to content

Commit

Permalink
feat: Implement quit statements
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed May 26, 2024
1 parent 22aed0f commit d2c1de6
Show file tree
Hide file tree
Showing 5 changed files with 4,592 additions and 4,562 deletions.
11 changes: 10 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ module.exports = grammar({
word: ($) => $.identifier,

rules: {
source_file: ($) => repeat(choice(seq($._expression, ";"), $._statement)),
source_file: ($) =>
repeat(
choice(
seq($._expression, ";"),
$._statement,
seq($.quit_statement, ";"),
),
),

// Statements
_statement: ($) =>
Expand Down Expand Up @@ -111,6 +118,8 @@ module.exports = grammar({
// https://docs.gap-system.org/doc/ref/chap5.html
),

quit_statement: (_) => /quit|QUIT/,

assignment_statement: ($) =>
seq(field("left", $._expression), ":=", field("right", $._expression)),

Expand Down
17 changes: 17 additions & 0 deletions src/grammar.json

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

8 changes: 8 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 d2c1de6

Please sign in to comment.