Author: bernhard
Date: Thu Feb 8 14:04:31 2007
New Revision: 16928
Modified:
trunk/languages/plumhead/src/partridge/Plumhead.pg
trunk/languages/plumhead/t/arithmetics.t
Log:
[Plumhead partridge]
Parse some forms of floats. No octal or hex yet.
Modified: trunk/languages/plumhead/src/partridge/Plumhead.pg
==============================================================================
--- trunk/languages/plumhead/src/partridge/Plumhead.pg (original)
+++ trunk/languages/plumhead/src/partridge/Plumhead.pg Thu Feb 8 14:04:31 2007
@@ -16,7 +16,7 @@
token PAREN_OPEN { \( }
token PAREN_CLOSE { \) }
-token NUMBER { \d+ }
+token NUMBER { \d+ ( . \d+ )? | . \d+ }
token UNARY_MINUS { \- }
token UNARY_PLUS { \+ }
Modified: trunk/languages/plumhead/t/arithmetics.t
==============================================================================
--- trunk/languages/plumhead/t/arithmetics.t (original)
+++ trunk/languages/plumhead/t/arithmetics.t Thu Feb 8 14:04:31 2007
@@ -97,6 +97,8 @@
[ ' ( 1 * 2 ) * 3 ', '6', ],
[ ' ( 1 * 2 ) + 3 ', '5', ],
[ ' ( 1 * 2 ) + ( ( ( ( 3 + 4 ) + 5 ) * 6 ) * 7 ) ', '506', ],
+ [ '1.2', '1.2', ],
+ [ '-1.23', '-1.23', ],
[ '.1', '0.1', 'Parrot says 0.1', ],
[ '-.1', '-0.1', 'Parrot bc says -0.1',],
[ '2 / 2 + .1', '1.1', ],
@@ -105,6 +107,8 @@
[ '-1.0000001', '-1.0000001', 'probably limited precission of Float PMC',
],
[ '1 & 3', '1', 'bitwise and', ],
[ '1 | 2', '3', 'bitwise or', ],
+ [ '010', 8, 'octal' ],
+ [ '0x10', 16, 'hex' ],
);
plan( tests => scalar(@tests) );