---
osname= darwin
osvers= 8.0
arch=   darwin-thread-multi-2level
cc=     cc
---
Flags:
     category=core
     severity=medium
     ack=no
---
As simple token containing ":i" causes PGE to crash with an attempted
method call on Undef.
Steps to reproduce:
   1) Create a grammar file called "foo.pg" that has one line:
      token foo { :i a }
   2) Run this command:
      ./parrot compilers/pge/pgc.pir --output=foo.pir foo.pg
Actual results:
    set_integer_keyed() not implemented in class 'Undef'
    current instr.: 'parrot;PGE::Exp::Quant;reduce' pc 4333  
(compilers/pge/PGE/Exp.pir:396)
    called from Sub 'parrot;PGE::Exp::Concat;reduce' pc 4098  
(compilers/pge/PGE/Exp.pir:316)
    called from Sub 'parrot;PGE::Exp;root_pir' pc 3609 (compilers/pge/ 
PGE/Exp.pir:69)
    called from Sub 'parrot;PGE::P6Regex;compile_p6regex' pc 6244  
(compilers/pge/PGE/P6Regex.pir:123)
    called from Sub 'parrot;PGE::P6Grammar;regex_stmt' pc 622  
(compilers/pge/pgc.pir:336)
    called from Sub 'parrot;PGE::P6Grammar;compile_p6grammar' pc 345  
(compilers/pge/pgc.pir:225)
    called from Sub 'parrot;PGE::P6Grammar;main' pc 135 (compilers/ 
pge/pgc.pir:111)
Expected results:
   Either a successful compile or a more understandable syntax error
Reproducibility:
   Reproduced on G5 Mac OS X 10.4.7, parrot r13176
   Reproduced on x86 FreeBSD 5.4, parrot r13181
   Reproduced on x86 Linux 7.x, parrot r13181
---
Summary of my parrot 0.4.5 (r13176) configuration:
   configdate='Thu Jul  6 00:20:50 2006'
   Platform:
     osname=darwin, archname=darwin-thread-multi-2level
     jitcapable=1, jitarchname=ppc-darwin,
     jitosname=DARWIN, jitcpuarch=ppc
     execcapable=1
     perl=perl
   Compiler:
     cc='cc', ccflags='-g -pipe -fno-common -no-cpp-precomp  -I/usr/ 
local/include
-pipe -fno-common -Wno-long-double  -I/sw/include -I/sw/include',
   Linker and Libraries:
     ld='c++', ldflags='-L/usr/local/lib -flat_namespace  -L/sw/lib - 
L/sw/lib',
     cc_ldflags='',
     libs='-lm -lgmp -lreadline'
   Dynamic Linking:
     share_ext='.dylib', ld_share_flags='-dynamiclib -undefined  
suppress',
     load_ext='.bundle', ld_load_flags='-bundle -undefined suppress'
   Types:
     iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4,
     ptrsize=4, ptr_alignment=1 byteorder=4321,
     nv=double, numvalsize=8, doublesize=8
---
Environment:
     DYLD_LIBRARY_PATH    HOME    LANG    LANGUAGE    LC_ALL     
LD_LIBRARY_PATH   LOGDIR    PATH    PERL5LIB     
PERL5_CPANPLUS_CONFIG    SHELL
As I read S05, a modifier has to occur at the *very* beginning
of a regex (or group) in order to work.  In other words, no whitespace
before modifiers in a regex (because whitespace may have some
other meta-syntactic meaning with :sigspace).  Thus
token foo {:i a }
works, while
token foo { :i a }
is an error, since the ':' acts as a cut operator that doesn't
have anything to cut.
But I admit that since we've gone to regex/token/rule, then perhaps
leading whitespace prior to a modifier should be ignored.  That
probably needs a ruling from p6l or @Larry.
Pm
Ahh, that makes sense.  So it's possibly just an uncaught syntax  
error, and definitely a syntax error under :sigspace.  I propose that  
P6Regex.pir gets something like:
       parse_error(mob, pos, "Too late for modifier")
but I have not yet figured out where it belongs in P6Regex.pir.
On a related note, I don't see any regression tests for syntactically  
incorrect regexps.  I'm good at writing invalid regexps :-) so if  
someone starts a stub .t file for syntax errors, I'd be happy to  
populate it with TODO tests like the above.
Chris
--
Chris Dolan, Software Developer, http://www.chrisdolan.net/
Public key: http://www.chrisdolan.net/public.key
vCard: http://www.chrisdolan.net/ChrisDolan.vcf