Commit cdd8f91
committed
Reject option 9: digit separators in floats (before decimal point)
Per WG17 decision, options 9-11 (float digit separators) are rejected
for consistency. This commit implements rejection of option 9 which
allowed digit separators before the decimal point (e.g., "1_0.0").
Changes:
- Modified skip_underscore_in_number() to return (char, bool) tuple
tracking whether an underscore was encountered
- Updated number_token() to track had_separator flag throughout parsing
- Added check before decimal point: reject if separators were used
- Error type: ParseBigInt (cannot parse as float with separators)
Tests:
- Added 3 tests verifying option 9 rejection via number_chars and atoms
- All tests now pass with proper error handling
- Integer separators (1_000) still work correctly
- Floats without separators (10.0) still work correctly
Behavior:
- BEFORE: number_chars(N, "1_0.0") → N = 10.0 (unexpected)
- AFTER: number_chars(N, "1_0.0") → error(syntax_error(...))
This addresses UWN's feedback that option 9 should be rejected for
consistency since options 10 and 11 (separators after decimal point
and in exponents) are also not supported.1 parent 47fbf5f commit cdd8f91
2 files changed
+46
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
723 | | - | |
| 723 | + | |
724 | 724 | | |
| 725 | + | |
725 | 726 | | |
726 | 727 | | |
| 728 | + | |
727 | 729 | | |
728 | 730 | | |
729 | 731 | | |
730 | 732 | | |
731 | 733 | | |
732 | | - | |
| 734 | + | |
733 | 735 | | |
734 | 736 | | |
735 | 737 | | |
736 | 738 | | |
737 | | - | |
| 739 | + | |
| 740 | + | |
738 | 741 | | |
739 | 742 | | |
740 | 743 | | |
| |||
764 | 767 | | |
765 | 768 | | |
766 | 769 | | |
| 770 | + | |
767 | 771 | | |
768 | 772 | | |
769 | 773 | | |
770 | | - | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
771 | 778 | | |
772 | 779 | | |
773 | 780 | | |
774 | 781 | | |
775 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
776 | 785 | | |
777 | 786 | | |
778 | 787 | | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
779 | 794 | | |
780 | 795 | | |
781 | 796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
0 commit comments