Mark Carter
2018-02-24 19:01:32 UTC
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?
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?