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

Feature add doccomments #37

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Feature add doccomments #37

wants to merge 2 commits into from

Conversation

pbeart
Copy link
Collaborator

@pbeart pbeart commented Dec 4, 2024

Outstanding:

  • Doc-comment not targeting anything should be a warning

@@ -329,6 +329,7 @@ module.exports = grammar({

// Extras

doc_comment: $ => /\/\/\/[^\n]*/,
single_line_comment: $ => /\/\/[^\n]*/,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, any doc_comment is also a valid match for single_line_comment. Best to make them explicitly disjoint (by adding ^\/ to single_line_comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems as though tree-sitter supports a not-quite "normal Regex" level of regular expression parsing (apparently LR(1)), so e.g. start-of-line characters don't seem to be allowed. Given this, it seems like making the regexes disjoint may not be possible and therefore it might be better to use tree-sitter's well-defined conflict resolution features e.g. precedence to make sure there are no improperly interpreted cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants