Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented May 26, 2022

Improve comments and variable names to make it clear that we allocate and build
a separate string only when necessary to handle escape sequences.

Rather than trying to actually implement the parsing of float values, which
cannot be done naively due to precision concerns, just parse the float grammar
then postprocess the parsed text into a form we can pass to `strtod` to do the
actual parsing of the value.

Since the float grammar reuses `num` and `hexnum` from the integer grammar but
does not care about overflow, add a mode to `LexIntCtx`, `num`, and `hexnum` to
allow parsing overflowing numbers.

For NaNs, store the payload as a separate value rather than as part of the
parsed double. The payload will be injected into the NaN at a higher level of
the parser once we know whether we are parsing an f64 or an f32 and therefore
know what the allowable payload values are.
@tlively
Copy link
Member Author

tlively commented May 26, 2022

tlively added 2 commits May 26, 2022 16:25
Improve comments and variable names to make it clear that we allocate and build
a separate string only when necessary to handle escape sequences.
@tlively tlively force-pushed the lex-str-escaped-rename branch from 1875a2b to acbd1f4 Compare May 26, 2022 23:25
@tlively
Copy link
Member Author

tlively commented May 27, 2022

Graphite Merge Job

Current status: ✅ Merged

This pull request was successfully merged as part of a stack.

This comment was auto-generated by Graphite.

Job Reference: A9XO0urDPXHWLrhQjA6D

Base automatically changed from lex-floats to main May 27, 2022 00:59
@tlively tlively merged commit 626132d into main May 27, 2022
@tlively tlively deleted the lex-str-escaped-rename branch May 27, 2022 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants