From: Ricardo Wurmus <rekado@elephly.net>
To: swedebugia <swedebugia@riseup.net>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Trouble with the PEG parser
Date: Sun, 30 Dec 2018 22:41:28 +0100 [thread overview]
Message-ID: <871s5yheuv.fsf@elephly.net> (raw)
In-Reply-To: <c1f88ecd-4232-9b0b-eea1-08b40b6e927f@riseup.net>
Hi swedebugia,
It’s not clear to me what kind of output you’re expecting. Let’s take
this example:
(define-peg-string-patterns
"comment <- entry* !.
entry <-- (! NL .)* NL*
NL < '\n'")
This works fine, but not on your “*test*” string, which contains the
character “\(”. Note that you are in a Guile string here, so e.g. “\n”
represents the actual newline character, not a two-character string.
Your attempt to escape an opening parenthesis led to the character “\(”.
This is what the string should look like:
(define *test*
";; test
;;test2
; test3
;test4
(define %tor-accounts
;; User account and groups for Tor.")
Here’s what I see:
scheme@(guile-user)> (peg:tree
(match-pattern comment *test*))
$18 = ((entry ";; test") (entry ";;test2") (entry "; test3") (entry ";test4") (entry "(define %tor-accounts") (entry " ;; User account and groups for Tor."))
Is this what you expect? It certainly is not the #F that you’re seeing.
FWIW, I suggest using s-expression patterns instead of string patterns.
--
Ricardo
prev parent reply other threads:[~2018-12-30 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-30 19:33 Trouble with the PEG parser swedebugia
2018-12-30 21:41 ` Ricardo Wurmus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871s5yheuv.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=guix-devel@gnu.org \
--cc=swedebugia@riseup.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.