-
Notifications
You must be signed in to change notification settings - Fork 171
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
[WIP]Feature/issue 660 #666
Conversation
Codecov Report
@@ Coverage Diff @@
## master #666 +/- ##
==========================================
- Coverage 82.94% 82.93% -0.02%
==========================================
Files 56 56
Lines 7501 7507 +6
==========================================
+ Hits 6222 6226 +4
- Misses 1027 1028 +1
- Partials 252 253 +1
Continue to review full report at Codecov.
|
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 it's worth to mention how the wrong cases would behave in Ruby. Like 1_
in Ruby will do nothing instead of raising an error
|
||
for isDigit(l.ch) || l.ch == '_' { | ||
|
||
if isDigit(l.ch) { |
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.
IMO I think the lexer should preserve the underscores in the token. In terms of responsibility, I don't think a lexer should be responsible for any code transformation. Removing them at this stage seems sort of magical.
IMO the token should be simplified at a later stage, maybe during parsing or eval?
Well I think @SD10 has a good point. Keeping those information to parser allows us to provide more sophisticated error message |
Here we are already transforming the token into a literal for goby/compiler/parser/data_type_parsing.go Line 12 in c00ad0c
Here for Float: goby/compiler/parser/data_type_parsing.go Line 26 in c00ad0c
I think this is a good place to do the transformation work. This is just my opinion. I'm a newbie 😊 |
It's also worth noting that in the Ruby lexer the underscores are maintained:
|
I will preserve the underscores in the token and handle it in parser, |
1_2_3
=> 1231_2.3_4
=> 12.341__2
=> Error_1
=> Error1_
=> ErrorThis closes #660