-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add StringLiteral.parse(), NumberLiteral.parse() #246
Conversation
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 is OK broadly, but there's a couple of details that I'd like to get changed.
For one, I think having an AbstractLiteral
base class would help a lot. I tried to understand {value}
in StringLiteral
, and it didn't make sense, until I figured that it probably does that because it's a base class to what NumberLiteral.process
returns. I'd move the comment from StringLiteral
here, which also helps to give NumberLiteral
a proper comment.
Then I've been pondering more on cook -> process ->
..., and wondered about parsed_value()
. What do you think? process
can be sooo many things ;-)
And lastly, I'd prefer more symmetry between the impls in StringLiteral
vs NumberLiteral
. One is inline in the AST node, the other has half the impl in a module. I'd be totally fine with just both being inline, but also if both are external. But that module should only expose parse_string_value
and parse_number_value
, and not helper data like KNOWN_ESCAPES
, IMHO.
257e7da
to
bc525ed
Compare
Thanks for the review, it was very helpful. I've updated the PR to address your feedback. I'm still to write tests. I considered a number of naming options for the processing method. I like your For this reason, I went for |
|
Can you give me a hint on why |
I apologize for not providing more context. My connectivity was poor last night. Is your question specifically about |
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.
Ah, OK, thanks.
It's been a couple of ages since I looked at the actual parser impls, thanks for the recap.
Fix #243. The PR is based on #242.
@Pike, how does this look to you? I'll add tests for both
process
methods later today.