Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sync integer parsing warnings/errors with STD.
Of note, the one that warns about leading 0 not being octal is now
shown.
  • Loading branch information
jnthn committed Mar 9, 2013
1 parent 8c0f875 commit b58945c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Perl6/Grammar.pm
Expand Up @@ -2560,10 +2560,10 @@ grammar Perl6::Grammar is HLL::Grammar does STD {

token numish {
[
| <dec_number>
| 'NaN' >>
| <integer>
| <dec_number>
| <rad_number>
| 'NaN' >>
| 'Inf' >>
| '+Inf' >>
| '-Inf' >>
Expand All @@ -2578,6 +2578,21 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
| $<coeff> = [ <int=.decint> ] <escale>
]
}

token integer {
[
| 0 [ b '_'? <VALUE=binint>
| o '_'? <VALUE=octint>
| x '_'? <VALUE=hexint>
| d '_'? <VALUE=decint>
| <VALUE=decint>
<!!{ $/.CURSOR.worry("Leading 0 does not indicate octal in Perl 6; please use 0o" ~ $<VALUE>.Str ~ " if you mean that") }>
]
| <VALUE=decint>
]
<!!before ['.' <?before \s | ',' | '=' | <terminator> > <.sorry: "Decimal point must be followed by digit">]? >
[ <?before '_' '_'+\d> <.sorry: "Only isolated underscores are allowed inside numbers"> ]?
}

token rad_number {
':' $<radix> = [\d+] <.unsp>?
Expand Down

0 comments on commit b58945c

Please sign in to comment.