Skip to content

Commit

Permalink
grammar: fix missing format related edge-cases (#12)
Browse files Browse the repository at this point in the history
This atleast makes the parser not error, there's probably some issues in
the AST generation but that kind of problem can wait until LSP-related
integration.

Fixes #10 
Fixes #11
  • Loading branch information
xTVaser authored Jan 28, 2024
1 parent e51d151 commit fc53b10
Show file tree
Hide file tree
Showing 6 changed files with 922 additions and 838 deletions.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ module.exports = grammar({
/[\[\]]/,
/[<>]/,
';',
'`',
seq(field('numberOfArgs', $._format_token), '*'),
'?',
"Newline",
seq(repeat(choice($._format_token, ',')), /[$rRbBdDgGxXeEoOsStTfF]/),
seq(repeat(choice($._format_token, ',')), /[$mrRbBdDgGxXeEoOsStTfF]/),
),
format_specifier: $ =>
prec.left(seq(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"scripts": {
"gen": "yarn tree-sitter generate",
"test": "yarn tree-sitter test",
"parse-sample": "yarn tree-sitter parse test/samples/sample.gc",
"parse-test": "yarn tree-sitter parse test/samples/test.gc"
"parse-sample": "yarn gen && yarn tree-sitter parse test/samples/sample.gc",
"parse-test": "yarn gen && yarn tree-sitter parse test/samples/test.gc"
},
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion src/grammar.json

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

Loading

0 comments on commit fc53b10

Please sign in to comment.