-
Notifications
You must be signed in to change notification settings - Fork 9
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
Extending comment scanning to resolve #24 #26
Conversation
So far, I have a very simple fix that does not modify the existing grammar. Please let me know if you would prefer a different approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good! Just a small comment on the variable name.
I start to think whether it's worth support parsing of comments too down the line, so we don't just strip out comments but can also put them back. 🤔
scanner.go
Outdated
@@ -13,13 +13,14 @@ var parseField bool | |||
// scanner is a lexical scanner | |||
type scanner struct { | |||
commentMode bool | |||
ignoreMode bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's better to call this "outsideEntry" or something like that to be clear that we're not switching into a different context mode (comment mode is when we're scanning comments, not affected by the grammar), but actually not inside an entry so we can ignore everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a great idea, definitely a much clearer name. I've updated it in a new commit.
Oh that's an interesting idea! Are you thinking of doing this with |
Hello @nickng, this project has been very useful for me with formatting my honours thesis, so thank you for maintaining it!
I have been looking into #24. For now, I've just written a unit test reproducing the issue, which fails on my machine. I also tried logging
s.String()
and it appears to be completely empty.I would like to try to solve the bug over the next few days. Please let me know if this is welcome, if I've made any mistakes with my test, or if you have any suggestions about how to approach fixing the bug.