Skip to content

Conversation

@aitap
Copy link

@aitap aitap commented Sep 14, 2022

  • Adjust gram.y to allow numeric literals looking like 1_000_000
  • Prepare tests for the new syntax
    • Basic cases
    • Hexadecimal floating point numerals
    • Negative cases
  • News entry
    • Add a PR number after submitting a feature request via Bugzilla and before submitting the patch
  • Update ?NumericConstants
  • Submit

@aitap
Copy link
Author

aitap commented Sep 20, 2022

The tests are green, and I can't think of anything else to add. Time to write the patch cover letter? @t-kalinowski, what do you think?


Hello,
Following this discussion from July 2022, the attached patch adds the syntax for underscore-separated numeric literals, tests for the new syntax and a paragraph and an example in ?NumericConstants. I've made sure to only allow underscores in the significant part of the number, one at a time.
I would like to acknowledge the help of Tomasz Kalinowski in preparing this feature request.


For extra style points, I'll try to predict the PR# right before posting the PR and patch in the same message.

@t-kalinowski
Copy link

Look great to me! This will be a very nice addition to R.

@aitap aitap changed the title WIP: Syntax for underscore-separated numerals Syntax for underscore-separated numerals Sep 20, 2022
aitap and others added 8 commits September 25, 2022 16:21
Adjust the lexer to skip over underscores in numeric literals where it
makes sense to do so.
Generating gram.c with a different version of Bison results in lots of
changes, but we should be fine with updating just the same parts we'd
changed in gram.y.
Document single underscores inside significand being ignored, give an example.
@aitap aitap force-pushed the underscore_numerals branch from f9c3fb2 to b37228f Compare September 25, 2022 13:21
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.

2 participants