On Wednesday 15 October 2008 05:54:59 Will Coleda wrote:
> The namespace of the generated file should be changed, the subclass
> should probably be updated. (TGE itself should probably be updated to
> not live a namespace with a '::' in it. The actual transform sub can
> keep the name it has, but the first parameter to add_rule() should
> probably be updated as well. This /should/ work with the new automatic
> translation of :: that PGE is doing.
Here's a patch for part of TGE to use the keyed form of classnames. PCT may
need some changes as well. In particular, the parsegrammar and astgrammar
methods in src/PCT/HLLCompiler.pir take strings as arguments, as in this
example from Pheme:
$P0 = get_hll_global ['PCT'], 'HLLCompiler'
$P1 = $P0.'new'()
$P1.'language'('Pheme')
$P1.'parsegrammar'( 'Pheme::Grammar' )
$P1.'astgrammar'( 'Pheme::AST::Grammar' )
They should probably transform these strings into keys internally, as
P6MetaObject does.
-- c
--- compilers/tge/TGE/Compiler.pir (revision 31999)
+++ compilers/tge/TGE/Compiler.pir (local)
@@ -397,10 +397,14 @@
.local string code
.local string type
.local string inherit
- type = grammar["type"]
+ type = grammar["type"]
inherit = grammar["inherit"]
- code = "\n.namespace"
+ code = "\n.namespace"
+
if type == '' goto no_type
+ .local pmc type_parts
+ type_parts = split '::', type
+ type = join "'; '", type_parts
code .= " [ '"
code .= type
code .= "' ]"
@@ -411,9 +415,9 @@
code .= " push_eh class_loaded\n"
code .= " $P1 = subclass '"
code .= inherit
- code .= "', '"
+ code .= "', [ '"
code .= type
- code .= "'\n"
+ code .= "' ]\n"
code .= " pop_eh\n"
code .= " class_loaded:\n"
code .= "\n.end\n\n"