lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Apologies if OMeta

   http://lambda-the-ultimate.org/node/2477

has already been mentioned on the list.  From the paper:

OMeta is based on a variant of Parsing Expression Grammars (PEGs)
[5]—a recognition-
based foundation for describing syntax—which we have extended to
handle arbitrary kinds of data.

On 10/4/07, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> > I noticed that when matching the following pattern:
> >
> >   patt1 / func1 * lpeg.P(func2) * patt2 * patt3
> >
> > func2 is called before func1, moreover, if func2() returns nil,
> > then func1 isn't called at all. While this behavior seems
> > reasonable, I fail to find it mentioned somewhere in the manual.
>
> All captures are "executed" only after the match succeeds (if it
> succeeds). I will add something about this to the manual.
>
>
> > And the question is: how to make results of func2() depend on
> > the captures of patt1 ?
>
> Currently you can't. Because captures are "executed" only after the
> match succeeds, patt1 captures do not exist when func2 is called. I am
> still thinking how to improve this relationship in a consistent way.
> (It would be nice if func2 could make its own captures too, or at least
> control what captures from patt1 to keep...)
>
> (Anyway, maybe in your example you are stretching a little too much
> the use of lpeg; lpeg is for parsing a program, not for running it.)
>
> -- Roberto
>


-- 
How wonderful it is that nobody need wait a single moment
before starting to improve the world.       -- Anne Frank
Paradise is exactly where you are
right now...only much, much better.    -- Laurie Anderson