From dsb at prairienet.org Fri Apr 6 15:08:46 2007 From: dsb at prairienet.org (dsb at prairienet.org) Date: Fri, 6 Apr 2007 10:08:46 -0500 (CDT) Subject: [cl-ppcre-devel] register-groups-bind tests all groups for nil Message-ID: <50872.192.17.3.107.1175872126.squirrel@mail.prairienet.org> Using register-groups-bind, sbcl generates a compiler warning if the user doesn't make sure each bound variable is non-nil before using it. Since the body is evaluated only if there's a match, testing bound variables seems kind of redundant for the first N variables, where N is the number of groups in the regex. It looks like an IF form in register-groups-bind is the source of the warning. It checks all groups for nil-ness, even the first ones. I thought variables that match groups would be guaranteed to be non-nil. I would be nice to be able to use matching variables immediately as long as the user is careful not to bind extra ones. I guess eliminating individual tests for bound groups would require that scan returns another value containing the number of matches, or truncates the register-groups array so that the number of matches is just the length of the array. Then matching variables could be bound directly, and extras could be set to nil without the IF. --Dan prairienet.org/~dsb/ From DKICK1 at motorola.com Fri Apr 6 16:52:34 2007 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Fri, 6 Apr 2007 12:52:34 -0400 Subject: [cl-ppcre-devel] register-groups-bind tests all groups for nil In-Reply-To: <50872.192.17.3.107.1175872126.squirrel@mail.prairienet.org> References: <50872.192.17.3.107.1175872126.squirrel@mail.prairienet.org> Message-ID: Consider the following ; CLISP Port: 1604 Pid: 3572 CL-USER> PG-USER> (register-groups-bind (x y z) ('(:sequence (:alternation (:register #\a) #\1) (:alternation (:register #\b) #\2) (:alternation (:register #\c) #\3)) "123") (values x y z)) NIL NIL NIL PG-USER> (register-groups-bind (x y z) ('(:sequence (:alternation (:register #\a) #\1) (:alternation (:register #\b) #\2) (:alternation (:register #\c) #\3)) "abc") (values x y z)) "a" "b" "c" PG-USER> -----Original Message----- From: cl-ppcre-devel-bounces at common-lisp.net [mailto:cl-ppcre-devel-bounces at common-lisp.net] On Behalf Of dsb at prairienet.org Sent: Friday, April 06, 2007 10:09 AM To: cl-ppcre-devel at common-lisp.net Subject: [cl-ppcre-devel] register-groups-bind tests all groups for nil Using register-groups-bind, sbcl generates a compiler warning if the user doesn't make sure each bound variable is non-nil before using it. Since the body is evaluated only if there's a match, testing bound variables seems kind of redundant for the first N variables, where N is the number of groups in the regex. It looks like an IF form in register-groups-bind is the source of the warning. It checks all groups for nil-ness, even the first ones. I thought variables that match groups would be guaranteed to be non-nil. I would be nice to be able to use matching variables immediately as long as the user is careful not to bind extra ones. I guess eliminating individual tests for bound groups would require that scan returns another value containing the number of matches, or truncates the register-groups array so that the number of matches is just the length of the array. Then matching variables could be bound directly, and extras could be set to nil without the IF. --Dan prairienet.org/~dsb/ _______________________________________________ cl-ppcre-devel site list cl-ppcre-devel at common-lisp.net http://common-lisp.net/mailman/listinfo/cl-ppcre-devel From dsb at prairienet.org Fri Apr 6 20:23:42 2007 From: dsb at prairienet.org (dsb at prairienet.org) Date: Fri, 6 Apr 2007 15:23:42 -0500 (CDT) Subject: [cl-ppcre-devel] register-groups-bind tests all groups for nil In-Reply-To: References: <50872.192.17.3.107.1175872126.squirrel@mail.prairienet.org> Message-ID: <44880.192.17.3.79.1175891022.squirrel@mail.prairienet.org> > (:alternation (:register #\a) #\1) > (:alternation (:register #\b) #\2) > (:alternation (:register #\c) #\3)) > "123") > "abc") I see. Thanks for the example. --Dan prairienet.org/~dsb/ From edi at agharta.de Mon Apr 23 15:13:20 2007 From: edi at agharta.de (Edi Weitz) Date: Mon, 23 Apr 2007 17:13:20 +0200 Subject: [cl-ppcre-devel] [Edi Weitz] Re: Lexer that keeps track of line and column #s Message-ID: For the list archive. (Sent to the wrong address originally.) -------------- next part -------------- An embedded message was scrubbed... From: Edi Weitz Subject: Re: Lexer that keeps track of line and column #s Date: Mon, 23 Apr 2007 12:26:47 +0200 Size: 1190 URL: