[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in peg parser for double-quotes?
From: |
Mark Carter |
Subject: |
Bug in peg parser for double-quotes? |
Date: |
Sat, 24 Feb 2018 19:01:32 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
I'm trying to use peg pattern matching to match quoted strings. It's not
complete, but I think I found a bug that is holding me back. consider
the following code:
(use-modules (ice-9 peg string-peg))
(use-modules (ice-9 peg using-parsers))
(define-peg-pattern DQ body "\"")
(define-peg-pattern astring body "(DQ .*)")
(define (pma str) (peg:tree (match-pattern DQ str)))
(define (pma1 str) (peg:tree (match-pattern astring str)))
If I execute:
(pma "\"hello")
then I get
$1 = "\""
which is correct. It matched the double-quote, as expected.
However, if I execute:
(pma1 "\"hello")
then I get
$2 = #f
which is wrong, I think. I'm expected it to match the double-quote, and
any other characters that it enounters. But it doesn't match anything.
Can someone confirm if this appears to be a bug in guile?
- Bug in peg parser for double-quotes?,
Mark Carter <=