[Top][All Lists]

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

Re: Make peg.el a built-in library?

From: Eric Abrahamsen
Subject: Re: Make peg.el a built-in library?
Date: Sun, 10 Oct 2021 14:40:37 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>> >> (1) Can we improve the introduction in the file header a bit?  I would
>> >> add a link to the wikipedia page:
>> >>
>> >>   https://en.wikipedia.org/wiki/Parsing_expression_grammar
>> >>
>> >> it explains some background.
>> >
>> > I can't speak for Helmut, but I think you should feel free to make such
>> > a change, yes.
>> I've still got this documentation patch I haven't applied, I can just
>> add that link to this patch?
> From my side, nothing against that.  I have quickly skimmed over your
> text and found nothing obviously wrong or confusing, and it makes some
> things a bit clearer.
> Should we say something about how to use globally defined pegs?  AFAIU
> you can use them like (my-peg) in parens, contrary to rules, which
> appear as plain symbols.  At least, this was one of the things I
> wondered while trying this out: what do I have to wrap in
> parens.

I'm not quite sure what you mean here. If you use the `define-peg-rule'
you can use the symbol plain, you don't have to wrap it in parentheses.
If you want to use one of the built-in action functions, like
"substring", then you have to wrap your symbol in that, same as if you
were defining a rule on the spot. But that's just for convenience. The

(substring <my-peg-symbol>)

is defined as:

(and `(-- (point))
     `(start -- (buffer-substring-no-properties start (point))))

I don't think you have to wrap anything in parentheses, though you *can*
if you want to, and it will work correctly.

Am I misunderstanding you?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]