with parrot revision 8086, i'm running the following:
.sub main @MAIN
.local pmc p6rule, rulesub, match
p6rule= find_global 'PGE', 'p6rule'
rulesub= p6rule( '( \\ \. )+ \\' )
which, under parrot -t, gives thousands of lines of output.
eventually, i get the following...
# Back in sub 'PGE :: p6rule'
20035 compreg P15, "PIR" - P15=Sub=PMC(0x7d3260 Adr:0x8b6d88),
20038 set S30, P17 - , P17=String=PMC(0x7d2e88 Str:".sub _pge_rule\n .")
20041 compile P30, P15, S30 -
S30=".sub _pge_rule\n ."
error:imcc:op not found 'index' (index<1>)
in file 'EVAL_1' line 42
if i read that correctly, it means i should stop coding, and start
installing tile in the kitchen. maybe somebody else has another take
on what's going on?
> .sub main @MAIN
> load_bytecode 'PGE.pbc'
> .local pmc p6rule, rulesub, match
> p6rule= find_global 'PGE', 'p6rule'
> rulesub= p6rule( '( \\ \. )+ \\' )
> which, under parrot -t, gives thousands of lines of output.
> eventually, i get the following...
> error:imcc:op not found 'index' (index<1>)
before the C<compile> in P6Rule.pir:876 reveals the culprit:
$I0 = index "\", $S0
i.e. an unescapted backslash inside double quotes. OTOH there is also:
lit = '\\'
which should have double quotes to mean a single slash.
This particular bug is now fixed in r8102.
PGE is not yet complete in its handling of escape sequences
in literal strings -- there are just a lot of them to be handled.
rx / \n / # match a newline character (a character class)
rx / <"\n"> / # match a literal newline (probably \012)
rx / <'\n'> / # match a backslash + n
and for any literal string that PGE generates it must be sure that
it's properly escaped for PIR. (Fortunately this past week I found
Data::Escape which helps quite a bit.)
> OTOH there is also:
> lit = '\\'
> which should have double quotes to mean a single slash.
Hmmm, that seems odd. I looked in P6PE to find out about string
literal escapes and basically came away with "they work like Perl 5",
but occasionally I've noticed places where there's a mismatch...
such as this one. I couldn't find anything about string literals
in the Parrot docs -- is it documented somewhere?
> ... I couldn't find anything about string literals
> in the Parrot docs -- is it documented somewhere?
I've updated imcc/docs/syntax.pod yesterday with a small section
regarding string escapes. Baiscally inside double quoted strings the
usual escaping is done, inside single quotes no escapes are honored.