Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upexpose Token, Value, TokenToName and Pos on LexToken #133
Conversation
codecov-commenter
commented
Jun 11, 2020
•
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
- Coverage 72.92% 72.85% -0.07%
==========================================
Files 60 60
Lines 12002 12013 +11
==========================================
Hits 8752 8752
- Misses 2715 2726 +11
Partials 535 535
Continue to review full report at Codecov.
|
Missed adding this one.
parser/lexer.go
Outdated
| @@ -330,6 +330,30 @@ func (lt *LexToken) String() string { | |||
| return fmt.Sprintf("%q (%d) = %T{%v} %d:%d", name, lt.token, lt.value, lt.value, lt.pos.Lineno, lt.pos.ColOffset) | |||
| } | |||
|
|
|||
| // TokenToName returns the string name of a given token | |||
| func (lt *LexToken) TokenToName() string { | |||
| name, ok := tokenToString[lt.token] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
sneakywombat
Jun 25, 2020
Author
sure, i'll take a look. random question, i hacked in comment support in my branch because I wanted to capture those. any interest in supporting comment capture in gpython? I saw that it was tossed away in lexer.go.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ncw
Jun 26, 2020
Collaborator
Comment support sounds interesting. Is it part of the standard Python lexer? I don't remember
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.
sneakywombat commentedJun 11, 2020
I am using your library to write a custom parser, and thus only depend on the lex functionality. While writing it, I found it useful to be able to access these values. Tossing it up here to see if you agree. thanks for writing such a new library!