Replies: 1 comment 1 reply
-
Would it be possible to define the annotations as a subfield of a comment? Looking at what you currently have in the repo, would something like this work? module.exports = grammar({
name: 'core',
extras: $ => [
/\s/,
$.comment,
],
rules: {
source_file: $ => repeat1($.declaration),
comment: _ => token(choice(
/--.*\n/,
seq('{-', field('annotation', /.*/), '-}'))),
... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I am trying to parse a language where comments contain annotations which I want to preserve. Now I have:
How can I preserve my
{- ... -}
comments in the AST? They could appear anywhere where whitespace is allowed. Thanks!Beta Was this translation helpful? Give feedback.
All reactions