Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add non-standard bracket form to parse common macros #35

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "[email protected]: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