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.
| @@ -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

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

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!