Skip to content

preserving comments #2868

Closed Answered by WillLillis
vzaliva asked this question in Q&A
Jan 19, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

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', /.*/), '-}'))),

...

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vzaliva
Comment options

Answer selected by amaanq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants