[cl-ppcre-devel] Strange parsing

13 views
Skip to first unread message

Ken Harris

unread,
Dec 4, 2008, 2:07:26 AM12/4/08
to cl-ppcr...@common-lisp.net
Hi, all,

When playing around with cl-ppcre 2.0.1, I've discovered this:

(cl-ppcre::parse-string "?") -> :QUESTION-MARK

I found this odd, since :QUESTION-MARK isn't part of the parse-tree
grammar in the docs. Two or more ("??", "???", etc.) also leave a
:QUESTION-MARK in the parse-tree. I took a quick look at the source
code, and it looks like :QUESTION-MARK is used by the lexer (with
other keywords like :CLOSE-PAREN), but that it seems to expect them to
be replaced by the time you end up with a parse-tree.

In comparison, if you try to use ")", like (cl-ppcre::parse-string
")"), it signals a condition in parse-string. I can't find any way to
get :CLOSE-PAREN in the output. It's a little weird that it can parse
"??" but then signals if you try to use it.

If I try to cl-ppcre:scan anything with one of these, I get a
ppcre-syntax-error, "Unknown token QUESTION-MARK in parse tree". I
don't know if this is a bug or not, and I don't think I'm going to run
into a situation where this matters, but there you go. :-)

cheers,


- Ken

_______________________________________________
cl-ppcre-devel site list
cl-ppcr...@common-lisp.net
http://common-lisp.net/mailman/listinfo/cl-ppcre-devel

Edi Weitz

unread,
Dec 4, 2008, 2:30:54 AM12/4/08
to General interest list about cl-ppcre and cl-unicode
On Wed, 3 Dec 2008 23:07:26 -0800, "Ken Harris" <keng...@gmail.com> wrote:

> When playing around with cl-ppcre 2.0.1, I've discovered this:
>
> (cl-ppcre::parse-string "?") -> :QUESTION-MARK
>
> I found this odd, since :QUESTION-MARK isn't part of the parse-tree
> grammar in the docs. Two or more ("??", "???", etc.) also leave a
> :QUESTION-MARK in the parse-tree. I took a quick look at the source
> code, and it looks like :QUESTION-MARK is used by the lexer (with
> other keywords like :CLOSE-PAREN), but that it seems to expect them
> to be replaced by the time you end up with a parse-tree.
>
> In comparison, if you try to use ")", like (cl-ppcre::parse-string
> ")"), it signals a condition in parse-string. I can't find any way
> to get :CLOSE-PAREN in the output. It's a little weird that it can
> parse "??" but then signals if you try to use it.
>
> If I try to cl-ppcre:scan anything with one of these, I get a
> ppcre-syntax-error, "Unknown token QUESTION-MARK in parse tree". I
> don't know if this is a bug or not, and I don't think I'm going to
> run into a situation where this matters, but there you go. :-)

Yeah, this looks like an oversight. I'll check.

Thanks for the report,
Edi.

Reply all
Reply to author
Forward
0 new messages