Merged
Conversation
shenao78
commented
Jul 29, 2021
| #include "y.tab.h" | ||
| %} | ||
|
|
||
| %x COMMENT |
Contributor
Author
There was a problem hiding this comment.
加入一个 COMMENT 开始条件,BEGIN(COMMENT)会启动这个条件,当该条件启动时,不带有的规则都将无效
具体参考 https://gist.github.com/DmitrySoshnikov/f5e2583b37e8f758c789cea9dcdf238a
shenao78
commented
Jul 29, 2021
| %% | ||
|
|
||
| "//" BEGIN(COMMENT); | ||
| <COMMENT>\n { BEGIN(0); return '\n'; } |
Contributor
Author
There was a problem hiding this comment.
把换行符返回的原因是,golang的每条语句之间必须包含换行符。当注释是那种尾注释时,换行符会被吃掉。
shenao78
commented
Jul 29, 2021
| %% | ||
|
|
||
| "//" BEGIN(COMMENT); | ||
| <COMMENT>\n { BEGIN(0); return '\n'; } |
Contributor
Author
There was a problem hiding this comment.
BEGIN(0)表示恢复到原始的状态
Paladz
approved these changes
Jul 29, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.