On Thu, Jul 06, 2006 at 12:29:12AM -0700, Allison Randal wrote: > >$ cat xyz.pir > >.sub main :main > > load_bytecode 'PGE.pbc' > > load_bytecode 'ar.pir' > > load_bytecode 'dumper.pbc' > > load_bytecode 'PGE/Dumper.pbc' > > > > $P0 = find_global 'XYZ', 'start' > > $P1 = $P0("\n\n\n\n\n\n\n", 'grammar' => 'XYZ') > > What the original didn't have is the 'grammar' named argument when > calling the start rule. When I replace the previous line with: > > $P1 = $P0("\n\n\n\n\n\n\n") > > then your sample code exhibits the same problem. I assume this means > that the reason overriding <ws> wasn't working is because it was calling > the default version of <ws> in the root namespace. But, if it was > defaulting to the root namespace, why was it able to find any of the > rules? Shouldn't it have complained that it couldn't find <emptyline>?
At the moment (and this may be incorrect), PGE looks for named rules via inheritance, and if not found that way it looks in the available symbol tables using the find_name opcode. So, the match was able to find the rules because they are in the current namespace, but when it came time to find the rule for <?ws> there was a "ws" method available (the default) and so that one was used. Again, this may not be the correct behavior; I've been using S12 as the guide here, in that a method call first considers methods from the class hierarchy and fails over to subroutine dispatch. Pm