Skip to content

Commit

Permalink
feat: add non-standard bracket form to parse common macros
Browse files Browse the repository at this point in the history
  • Loading branch information
theHamsta committed Apr 6, 2024
1 parent 83ae738 commit b28bc14
Show file tree
Hide file tree
Showing 8 changed files with 149,475 additions and 143,122 deletions.
10 changes: 10 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ module.exports = grammar(clojure, {
$.unquoting_lit,
$.include_reader_macro,
$.complex_num_lit,
$.bracket_form,
".",
)),

Expand All @@ -382,6 +383,15 @@ module.exports = grammar(clojure, {
repeat($._gap),
field('target', $._form)),

// This is a non-standard syntax. However, it seems to be popular for macors
// (see https://github.com/tree-sitter-grammars/tree-sitter-commonlisp/issues/27)
bracket_form: $ =>
seq('[',
optional($._gap),
optional(seq($._form, repeat(seq($._gap, $._form)))),
optional($._gap),
']'),

complex_num_lit: $ =>
seq(repeat($._metadata_lit),
field('marker', choice("#C", "#c")),
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"url": "git://github.com/theHamsta/tree-sitter-commonlisp"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.8",
"tree-sitter-cli": "^0.22.2",
"tree-sitter-clojure": "git@github.com:theHamsta/tree-sitter-clojure.git#commonlisp",
"prebuildify": "^6.0.0"
},
Expand Down
74 changes: 74 additions & 0 deletions 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 b28bc14

Please # to comment.