From kengruven at gmail.com Thu Dec 4 07:07:26 2008 From: kengruven at gmail.com (Ken Harris) Date: Wed, 3 Dec 2008 23:07:26 -0800 Subject: [cl-ppcre-devel] Strange parsing Message-ID: 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 From edi at agharta.de Thu Dec 4 07:30:54 2008 From: edi at agharta.de (Edi Weitz) Date: Thu, 04 Dec 2008 08:30:54 +0100 Subject: [cl-ppcre-devel] Strange parsing In-Reply-To: (Ken Harris's message of "Wed, 3 Dec 2008 23:07:26 -0800") References: Message-ID: On Wed, 3 Dec 2008 23:07:26 -0800, "Ken Harris" 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.