PGE optable whitespace question

Patrick R. Michaud pmichaud at pobox.com
Wed Sep 24 22:58:33 UTC 2008


On Wed, Sep 24, 2008 at 06:19:10PM -0400, Will Coleda wrote:
> A naive conversion of the <ws> rule to \s* instead of \h* breaks the
> parsing of the most of the test suite  (but allows this snippet to
> work.
> 
> This makes me think that the right approach might be to have two
> grammars, one for the language, one for the expressions, and then
> override the <ws> rule in the one just for the expression. Is this
> possible?
> 
> Or, hopefully, is there a simple solution I'm missing?

I _think_ you can get the expression parser to use a custom <.ws> rule --
let's call it <exprws>:

    $P0 = get_hll_global ['TclExpr::Grammar'], '$optable'
    $P1 = get_hll_global ['TclExpr::Grammar'], 'exprws'
    setattribute $P0, '&!ws', $p1

Pm


More information about the parrot-dev mailing list