Patrick R. Michaud wrote:
On Tue, Jul 04, 2006 at 12:57:16PM -0700, Allison Randal wrote:
------
token start { ^<emptyline>*$ }
regex emptyline { ^^ $$ \n }
token ws { [<sp> | \t]* }
------
The above grammar doesn't have a "grammar" statement; as a result
the regexes are being installed into the '' namespace.
The original did have a 'grammar' statement, I just didn't paste it into
the email.
$ 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>?
Thanks,
Allison