The TGE patch seems to work, but I got test failure from my PGE patch.
Patrick? Allison?
=== compilers/tge/TGE/Compiler.pir
==================================================================
--- compilers/tge/TGE/Compiler.pir (revision 13181)
+++ compilers/tge/TGE/Compiler.pir (local)
@@ -380,6 +380,9 @@
.return (code)
.end
+# NOTE - this code assumes that a type of '' is impossible
+# (in older versions of Parrot, it was)
+
.sub 'grammar_string' :method
.param pmc grammar
.local string code
@@ -387,9 +390,13 @@
.local string inherit
type = grammar["type"]
inherit = grammar["inherit"]
- code = "\n.namespace [ '"
+ code = "\n.namespace"
+ if type == '' goto no_type
+ code .= " [ '"
code .= type
- code .= "' ]\n\n"
+ code .= "' ]"
+ no_type:
+ code .= "\n\n"
code .= ".sub '__onload' :load\n"
code .= " load_bytecode 'TGE.pbc'\n"
code .= " $I0 = find_type '"
=== compilers/pge/PGE/P6Regex.pir
==================================================================
--- compilers/pge/PGE/P6Regex.pir (revision 13181)
+++ compilers/pge/PGE/P6Regex.pir (local)
@@ -117,9 +117,14 @@
pir:
.local pmc code
.local string grammar
+ .local string nsformat
grammar = adverbs['grammar']
+ nsformat = ".namespace"
+ if grammar == '' goto pir_emit
+ nsformat = ".namespace [ '%0' ]"
+ pir_emit:
code = new 'PGE::CodeString'
- code.emit(".namespace [ '%0' ]", grammar)
+ code.emit(nsformat, grammar)
$P0 = exp.root_pir(adverbs :flat :named)
code .= $P0
if target != 'PIR' goto bytecode
--
Chip Salzenberg <ch...@pobox.com>
TGE and PGE both need a thorough going-over for the new namespaces
implementation.
I'm thinking they should act in an HLL-agnostic fashion, so it's
possible to compile one grammar in, say, the Perl 6 HLL namespace,
another in Ruby, another in Python, and another system-internal grammar
into 'parrot'.
Allison
Indeed, the patch has nothing to do with extending full nested namespace
support to TGE and PGE. It's just a regression fix now that .namespace ['']
doesn't do what it used to.
Unless you're planning to do that overhaul before 0.4.6, I'd like to at
least avoid those regressions.
--
Chip Salzenberg <ch...@pobox.com>
i don't mind broken tests between releases, but if this patch won't be
applied in the next day or three, let me know. the tests can be marked
as TODO, and we can eagerly wait for the day of unexpected success
that will surely follow.
~jerry
Oh, I didn't mean "don't apply it", just "there's more work ahead". I
can't speak for Patrick, but go ahead and apply the TGE patch.
Chip, did you resolve the failing PGE test(s)?
Allison
Oddly enough, no. I actually made it worse, to my great surprise. Still
hacking tho...
--
Chip Salzenberg <ch...@pobox.com>
Strangely enough, yes. Apparently I hadn't waved enough 'make clean'
chickens over the computer. All better now.
--
Chip Salzenberg <ch...@pobox.com>
Maybe an automagical namespace alias 'root' is feasible?
--
Affijn, Ruud
"Gewoon is een tijger."