Skip to content

Commit

Permalink
feat: Add support for pragmas
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed May 26, 2024
1 parent 254dd7f commit ae89ad9
Show file tree
Hide file tree
Showing 5 changed files with 9,031 additions and 8,267 deletions.
8 changes: 3 additions & 5 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = grammar({
$._trailing_period_float,
],

extras: ($) => [$.comment, /\s/, $._line_continuation],
extras: ($) => [$.comment, $.pragma, /\s/, $._line_continuation],

inline: ($) => [$._expression, $._statement],

Expand Down Expand Up @@ -103,10 +103,6 @@ module.exports = grammar({
// NOTE: (reiniscirpons) these are already distinguished as builtin
// functions in ./queries/highlights.scm, we probably dont need to do
// anything special in the grammar itself.

// TODO: (fingolfin) add support for pragmas ???
// NOTE: (reiniscirpons) Pragmas are described in the GAP manual:
// https://docs.gap-system.org/doc/ref/chap5.html
),

quit_statement: (_) => /quit|QUIT/,
Expand Down Expand Up @@ -538,6 +534,8 @@ module.exports = grammar({

qualifier: (_) => choice("readonly", "readwrite"),

pragma: (_) => token(seq("#%", /.*/)),

comment: (_) => token(seq("#", /.*/)),

// GAP source file location: src/io.c GetNextChar
Expand Down
20 changes: 20 additions & 0 deletions src/grammar.json

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

4 changes: 4 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 ae89ad9

Please sign in to comment.