On Fri, Jun 18, 2010 at 10:26 PM, ajs <[email protected]> wrote:
> Attached, I've included test results, the tests and the patch (both to the
> spectest suite and nqp-rx) to support this spec change.
No... no I didn't. Here it is, attached as text.
--
Aaron Sherman
Email or GTalk: [email protected]
http://www.ajs.com/~ajs
+ /usr/bin/perl t/harness --keep-exit-code --icu=1 --jobs
t/spec/S02-literals/underscores.t
t/spec/S02-literals/underscores.t .. ok
All tests successful.
Files=1, Tests=31, 2 wallclock secs ( 0.00 usr 0.08 sys + 1.23 cusr 0.70
csys = 2.01 CPU)
Result: PASS
+ svn diff t/spec
Index: t/spec/S02-literals/underscores.t
===================================================================
--- t/spec/S02-literals/underscores.t (revision 31371)
+++ t/spec/S02-literals/underscores.t (working copy)
@@ -13,7 +13,7 @@
=end pod
-plan 19;
+plan 31;
is 1_0, 10, "Single embedded underscore works";
@@ -51,4 +51,17 @@
dies_ok { 2._123 }, "2._123 parses as method call";
dies_ok { 2._e23 }, "2._23 parses as method call";
+is 0b1101111, 111, "0b for base 2 parses";
+is 0b110_1111, 111, "0b for base 2 with underscore parses";
+is 0b_110_1111, 111, "0b for base 2 with underscore after radix parses";
+is 0o157, 111, "0o for base 8 parses";
+is 0o1_57, 111, "0o for base 8 with underscore parses";
+is 0o_1_57, 111, "0o for base 8 with underscore after radix parses";
+is 0d111, 111, "0d for base 10 parses";
+is 0d1_11, 111, "0d for base 10 with underscore parses";
+is 0d_1_11, 111, "0d for base 10 with underscore after radix parses";
+is 0x6f, 111, "0x for base 16 parses";
+is 0x6_f, 111, "0x for base 16 with underscore parses";
+is 0x_6_f, 111, "0x for base 16 with underscore after radix parses";
+
# vim: ft=perl6
+ git diff
diff --git a/src/HLL/Grammar.pm b/src/HLL/Grammar.pm
index 2f486ee..82940dc 100644
--- a/src/HLL/Grammar.pm
+++ b/src/HLL/Grammar.pm
@@ -59,10 +59,10 @@ grammar HLL::Grammar;
token integer {
[
- | 0 [ b <VALUE=binint>
- | o <VALUE=octint>
- | x <VALUE=hexint>
- | d <VALUE=decint>
+ | 0 [ b _? <VALUE=binint>
+ | o _? <VALUE=octint>
+ | x _? <VALUE=hexint>
+ | d _? <VALUE=decint>
]
| <VALUE=decint>
]