in reply to Re^2: HOP::Lexer not doing what I expected
in thread HOP::Lexer not doing what I expected

Yes but at least he got QUOTED to match, which is something I couldn't do.

I just can't make sense of the ordering rules.

  • Comment on Re^3: HOP::Lexer not doing what I expected

Replies are listed 'Best First'.
Re^4: HOP::Lexer not doing what I expected
by cmarcelo (Scribe) on Nov 11, 2006 at 19:41 UTC
    This gives the output you wanted:
    [ DQWORD => qr/"\w+"/ ], [ DQUOTED => qr/"[^"]+"/ ], [ QUOTED => qr/'[^']*'/ ], [ WORD => qr/\w+/i ], [ COMMA => qr/,/ ], [ SPACE => qr/\s+/, sub {} ],
    Note that we need to place DQWORD before DQUOTED since the first is a subset of the second (everything first matches second will match). QUOTED can be before or after the double quoted rules. Still don't understand why WORD can't be the first one, though.