[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-peg-devel] Re: Experimenting with peg.el
From: |
Sebastian Tennant |
Subject: |
[Emacs-peg-devel] Re: Experimenting with peg.el |
Date: |
Mon, 26 Jan 2009 20:29:44 +0000 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) |
Quoth Helmut Eller <address@hidden>:
> Sebastian Tennant [2009-01-19 15:25+0100] writes:
>> This returns nil, but point does at least advance to the end of the
>> alias definition.
>
> nil as return value means that some rule failed to match. In the
> example, command will consume everything so that nothing is left for the
> closing quot-mark. You could use something like this:
>
> (defun peg-parse-alias ()
> (peg-parse
> (definition
> (substring keyword)
> ws name equals-sign quot-mark
> (substring command)
> quot-mark)
> (keyword "alias")
> (ws (* (or " " "\t")))
> (name (+ [a-z]))
> (equals-sign "=")
> (quot-mark (or "\"" "'"))
> (command (+ (not quot-mark) (any)))
> ))
>
> Note the new rule for command. The (not quot-mark) ensures that
> quote-mark can match afterwards. This (+ (not FOO) (any)) is the
> typical idiom for consuming everything upto the first FOO.
Thanks a lot Helmut. It's quite clear to me now. I hadn't grasped the
use of 'substring' either. I'll work on the stack action soon (and I'm
bound to have some questions when I do).
> If you don't mind you can post questions [to the mailing list] to
> preserve them for the public.
Of course. I subscribed (using the link you provided) about 20 mins ago
and still hadn't received a confirmation email. Then it occurred to me
that you might have decided to dispense with confirmation emails
altogether.
Regards,
Sebastian
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
- [Emacs-peg-devel] Re: Experimenting with peg.el,
Sebastian Tennant <=