hi attached a patch for languages/PIR fixing:
* added optional "utf8:" encoding specifier (according to docs/imcc/syntax.pod)
* fixed support for binary and hex. numbers * added test for these changes. regards, klaas-jan
Index: languages/PIR/lib/pir.pg =================================================================== --- languages/PIR/lib/pir.pg (revision 16923) +++ languages/PIR/lib/pir.pg (working copy) @@ -703,19 +703,17 @@ # token int_constant { - [-]? \d+ - | <binary_constant> + <binary_constant> | <hex_constant> + | [-]? \d+ } -# FIXTHIS -regex hex_constant { - \d+ +token hex_constant { + 0x\d+ } -# FIXTHIS -regex binary_constant { - \d+ +token binary_constant { + 0b\d+ } token float_constant { @@ -724,10 +722,13 @@ rule string_constant { - <charset_specifier>? + [ <encoding_specifier>? <charset_specifier> ]? [ <stringdouble> | <stringsingle> ] } +rule encoding_specifier { + <'utf8:'> +} rule charset_specifier { [ <'ascii:'> | <'binary:'> | <'unicode:'> | <'iso-8859-1:'> ] Index: languages/PIR/t/assign.t =================================================================== --- languages/PIR/t/assign.t (revision 16923) +++ languages/PIR/t/assign.t (working copy) @@ -3,7 +3,7 @@ use strict; use warnings; use lib qw(t . lib ../lib ../../lib ../../../lib); -use Parrot::Test tests => 6; +use Parrot::Test tests => 7; use Test::More; language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'simple assignments' ); @@ -18,6 +18,16 @@ Parse successful! OUT +language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'int/hex/bin' ); +.sub main + a = 10 + b = 0b10 + c = 0x10 +.end +CODE +"parse" => PMC 'PIRGrammar' { ... } +Parse successful! +OUT language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'get keyed assignments' ); .sub main @@ -93,6 +103,7 @@ s = binary:"Hello WOrld" s = unicode:"Hello world" s = iso-8859-1:"Hello world" + s = utf8:unicode:"Hello World" .end CODE "parse" => PMC 'PIRGrammar' { ... }