From eweitz at common-lisp.net Thu Apr 22 18:53:15 2004 From: eweitz at common-lisp.net (Edi Weitz) Date: Thu, 22 Apr 2004 14:53:15 -0400 Subject: [cl-ppcre-cvs] CVS update: cl-ppcre/api.lisp cl-ppcre/cl-ppcre-test.asd cl-ppcre/cl-ppcre-test.system cl-ppcre/cl-ppcre.asd cl-ppcre/cl-ppcre.system cl-ppcre/closures.lisp cl-ppcre/convert.lisp cl-ppcre/errors.lisp cl-ppcre/lexer.lisp cl-ppcre/load.lisp cl-ppcre/optimize.lisp cl-ppcre/packages.lisp cl-ppcre/parser.lisp cl-ppcre/ppcre-tests.lisp cl-ppcre/regex-class.lisp cl-ppcre/repetition-closures.lisp cl-ppcre/scanner.lisp cl-ppcre/specials.lisp cl-ppcre/util.lisp Message-ID: Update of /project/cl-ppcre/cvsroot/cl-ppcre In directory common-lisp.net:/tmp/cvs-serv918 Modified Files: api.lisp cl-ppcre-test.asd cl-ppcre-test.system cl-ppcre.asd cl-ppcre.system closures.lisp convert.lisp errors.lisp lexer.lisp load.lisp optimize.lisp packages.lisp parser.lisp ppcre-tests.lisp regex-class.lisp repetition-closures.lisp scanner.lisp specials.lisp util.lisp Log Message: pre-0.7.7, including hyperdoc support Date: Thu Apr 22 14:53:13 2004 Author: eweitz Index: cl-ppcre/api.lisp diff -u cl-ppcre/api.lisp:1.1.1.1 cl-ppcre/api.lisp:1.2 --- cl-ppcre/api.lisp:1.1.1.1 Tue Jan 6 19:57:41 2004 +++ cl-ppcre/api.lisp Thu Apr 22 14:53:13 2004 @@ -1,9 +1,9 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/api.lisp,v 1.1.1.1 2004/01/07 00:57:41 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/api.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; The external API for creating and using scanners. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -555,7 +555,7 @@ (push end pos-list) ;; now collect substrings (nreverse - (loop with substr-fn = (if sharedp #'nsubseq #'nsubseq) + (loop with substr-fn = (if sharedp #'nsubseq #'subseq) with string-seen = nil for (this-end this-start) on pos-list by #'cddr ;; skip empty strings from end of list @@ -568,6 +568,14 @@ (funcall substr-fn target-string this-start this-end) nil))))) + +(define-compiler-macro split (&whole form regex target-string &rest rest) + "Make sure that constant forms are compiled into scanners at compile time." + (cond ((constantp regex) + `(split (load-time-value + (create-scanner ,regex)) + ,target-string , at rest)) + (t form))) (defun string-case-modifier (str from to start end) (declare (optimize speed Index: cl-ppcre/cl-ppcre-test.asd diff -u cl-ppcre/cl-ppcre-test.asd:1.1.1.1 cl-ppcre/cl-ppcre-test.asd:1.2 --- cl-ppcre/cl-ppcre-test.asd:1.1.1.1 Tue Jan 6 19:58:42 2004 +++ cl-ppcre/cl-ppcre-test.asd Thu Apr 22 14:53:13 2004 @@ -1,9 +1,9 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre-test.asd,v 1.1.1.1 2004/01/07 00:58:42 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre-test.asd,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; This ASDF system definition was kindly provided by Marco Baringer. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/cl-ppcre-test.system diff -u cl-ppcre/cl-ppcre-test.system:1.1.1.1 cl-ppcre/cl-ppcre-test.system:1.2 --- cl-ppcre/cl-ppcre-test.system:1.1.1.1 Tue Jan 6 19:57:36 2004 +++ cl-ppcre/cl-ppcre-test.system Thu Apr 22 14:53:13 2004 @@ -1,7 +1,7 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre-test.system,v 1.1.1.1 2004/01/07 00:57:36 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre-test.system,v 1.2 2004/04/22 18:53:13 eweitz Exp $ -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/cl-ppcre.asd diff -u cl-ppcre/cl-ppcre.asd:1.1.1.1 cl-ppcre/cl-ppcre.asd:1.2 --- cl-ppcre/cl-ppcre.asd:1.1.1.1 Tue Jan 6 19:57:35 2004 +++ cl-ppcre/cl-ppcre.asd Thu Apr 22 14:53:13 2004 @@ -1,9 +1,9 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre.asd,v 1.1.1.1 2004/01/07 00:57:35 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre.asd,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; This ASDF system definition was kindly provided by Marco Baringer. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/cl-ppcre.system diff -u cl-ppcre/cl-ppcre.system:1.1.1.1 cl-ppcre/cl-ppcre.system:1.2 --- cl-ppcre/cl-ppcre.system:1.1.1.1 Tue Jan 6 19:58:47 2004 +++ cl-ppcre/cl-ppcre.system Thu Apr 22 14:53:13 2004 @@ -1,7 +1,7 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre.system,v 1.1.1.1 2004/01/07 00:58:47 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/cl-ppcre.system,v 1.2 2004/04/22 18:53:13 eweitz Exp $ -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/closures.lisp diff -u cl-ppcre/closures.lisp:1.1.1.1 cl-ppcre/closures.lisp:1.2 --- cl-ppcre/closures.lisp:1.1.1.1 Tue Jan 6 19:58:43 2004 +++ cl-ppcre/closures.lisp Thu Apr 22 14:53:13 2004 @@ -1,10 +1,10 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/closures.lisp,v 1.1.1.1 2004/01/07 00:58:43 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/closures.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; Here we create the closures which together build the final ;;; scanner. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/convert.lisp diff -u cl-ppcre/convert.lisp:1.1.1.1 cl-ppcre/convert.lisp:1.2 --- cl-ppcre/convert.lisp:1.1.1.1 Tue Jan 6 19:58:57 2004 +++ cl-ppcre/convert.lisp Thu Apr 22 14:53:13 2004 @@ -1,11 +1,11 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/convert.lisp,v 1.1.1.1 2004/01/07 00:58:57 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/convert.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; Here the parse tree is converted into its internal representation ;;; using REGEX objects. At the same time some optimizations are ;;; already applied. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/errors.lisp diff -u cl-ppcre/errors.lisp:1.1.1.1 cl-ppcre/errors.lisp:1.2 --- cl-ppcre/errors.lisp:1.1.1.1 Tue Jan 6 19:57:36 2004 +++ cl-ppcre/errors.lisp Thu Apr 22 14:53:13 2004 @@ -1,7 +1,7 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE-LISP; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/errors.lisp,v 1.1.1.1 2004/01/07 00:57:36 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/errors.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -50,7 +50,19 @@ (simple-condition-format-control condition) (simple-condition-format-arguments condition) (ppcre-syntax-error-pos condition) - (ppcre-syntax-error-string condition))))) + (ppcre-syntax-error-string condition)))) + (:documentation "Signaled if CL-PPCRE's parser encounters an error +when trying to parse a regex string or to convert a parse tree into +its internal representation.")) + +(setf (documentation 'ppcre-syntax-error-string 'function) + "Returns the string the parser was parsing when the error was +encountered \(or NIL if the error happened while trying to convert a +parse tree).") + +(setf (documentation 'ppcre-syntax-error-pos 'function) + "Returns the position within the string where the error occured +\(or NIL if the error happened while trying to convert a parse tree") (define-condition ppcre-invocation-error (ppcre-error) () Index: cl-ppcre/lexer.lisp diff -u cl-ppcre/lexer.lisp:1.1.1.1 cl-ppcre/lexer.lisp:1.2 --- cl-ppcre/lexer.lisp:1.1.1.1 Tue Jan 6 19:59:12 2004 +++ cl-ppcre/lexer.lisp Thu Apr 22 14:53:13 2004 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/lexer.lisp,v 1.1.1.1 2004/01/07 00:59:12 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/lexer.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; The lexer's responsibility is to convert the regex string into a ;;; sequence of tokens which are in turn consumed by the parser. @@ -9,7 +9,7 @@ ;;; has opened so far. (The latter is necessary for interpreting ;;; strings like "\\10" correctly.) -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -165,7 +165,7 @@ while (and skip-char (char/= skip-char #\))) finally (return skip-char)) - (signal-ppcre-syntax-error + (signal-ppcre-syntax-error* error-pos "Comment group not closed"))) (setq next-char (next-char-non-extended lexer))) @@ -282,7 +282,7 @@ (let ((code (logand #o377 (the fixnum (or number 0))))) (or (and (< code char-code-limit) (code-char code)) - (signal-ppcre-syntax-error + (signal-ppcre-syntax-error* error-pos "No character for hex-code ~X" number)))) Index: cl-ppcre/load.lisp diff -u cl-ppcre/load.lisp:1.1.1.1 cl-ppcre/load.lisp:1.2 --- cl-ppcre/load.lisp:1.1.1.1 Tue Jan 6 19:57:43 2004 +++ cl-ppcre/load.lisp Thu Apr 22 14:53:13 2004 @@ -1,7 +1,7 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/load.lisp,v 1.1.1.1 2004/01/07 00:57:43 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/load.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/optimize.lisp diff -u cl-ppcre/optimize.lisp:1.1.1.1 cl-ppcre/optimize.lisp:1.2 --- cl-ppcre/optimize.lisp:1.1.1.1 Tue Jan 6 19:59:16 2004 +++ cl-ppcre/optimize.lisp Thu Apr 22 14:53:13 2004 @@ -1,10 +1,10 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/optimize.lisp,v 1.1.1.1 2004/01/07 00:59:16 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/optimize.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; This file contains optimizations which can be applied to converted ;;; parse trees. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -580,7 +580,7 @@ (compute-min-rest (regex standalone) 0)) (defmethod compute-min-rest ((lookahead lookahead) current-min-rest) - (compute-min-rest (regex lookahead) current-min-rest) + (compute-min-rest (regex lookahead) 0) current-min-rest) (defmethod compute-min-rest ((lookbehind lookbehind) current-min-rest) Index: cl-ppcre/packages.lisp diff -u cl-ppcre/packages.lisp:1.1.1.1 cl-ppcre/packages.lisp:1.2 --- cl-ppcre/packages.lisp:1.1.1.1 Tue Jan 6 19:57:36 2004 +++ cl-ppcre/packages.lisp Thu Apr 22 14:53:13 2004 @@ -1,7 +1,7 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/packages.lisp,v 1.1.1.1 2004/01/07 00:57:36 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/packages.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/parser.lisp diff -u cl-ppcre/parser.lisp:1.1.1.1 cl-ppcre/parser.lisp:1.2 --- cl-ppcre/parser.lisp:1.1.1.1 Tue Jan 6 19:57:41 2004 +++ cl-ppcre/parser.lisp Thu Apr 22 14:53:13 2004 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/parser.lisp,v 1.1.1.1 2004/01/07 00:57:41 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/parser.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; The parser will - with the help of the lexer - parse a regex ;;; string and convert it into a "parse tree" (see docs for details @@ -7,7 +7,7 @@ ;;; illegal parse trees. It is assumed that the conversion process ;;; later on will track them down. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/ppcre-tests.lisp diff -u cl-ppcre/ppcre-tests.lisp:1.1.1.1 cl-ppcre/ppcre-tests.lisp:1.2 --- cl-ppcre/ppcre-tests.lisp:1.1.1.1 Tue Jan 6 19:58:45 2004 +++ cl-ppcre/ppcre-tests.lisp Thu Apr 22 14:53:13 2004 @@ -1,7 +1,7 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE-TEST; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/ppcre-tests.lisp,v 1.1.1.1 2004/01/07 00:58:45 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/ppcre-tests.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/regex-class.lisp diff -u cl-ppcre/regex-class.lisp:1.1.1.1 cl-ppcre/regex-class.lisp:1.2 --- cl-ppcre/regex-class.lisp:1.1.1.1 Tue Jan 6 19:58:47 2004 +++ cl-ppcre/regex-class.lisp Thu Apr 22 14:53:13 2004 @@ -1,11 +1,11 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/regex-class.lisp,v 1.1.1.1 2004/01/07 00:58:47 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/regex-class.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; This file defines the REGEX class and some utility methods for ;;; this class. REGEX objects are used to represent the (transformed) ;;; parse trees internally -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions Index: cl-ppcre/repetition-closures.lisp diff -u cl-ppcre/repetition-closures.lisp:1.1.1.1 cl-ppcre/repetition-closures.lisp:1.2 --- cl-ppcre/repetition-closures.lisp:1.1.1.1 Tue Jan 6 19:59:05 2004 +++ cl-ppcre/repetition-closures.lisp Thu Apr 22 14:53:13 2004 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/repetition-closures.lisp,v 1.1.1.1 2004/01/07 00:59:05 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/repetition-closures.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; This is actually a part of closures.lisp which we put into a ;;; separate file because it is rather complex. We only deal with @@ -7,7 +7,7 @@ ;;; rather crazy micro-optimizations which were introduced to be as ;;; competitive with Perl as possible in tight loops. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -721,8 +721,8 @@ (declare (type fixnum start-pos)) (let ((next-pos (+ start-pos repetitions))) (declare (type fixnum next-pos)) - (or (<= next-pos *end-pos*) - (funcall next-fn next-pos)))) + (and (<= next-pos *end-pos*) + (funcall next-fn next-pos)))) ;; a dot which is not in single-line-mode - make sure we ;; don't match #\Newline (constant-repetition-constant-length-closure Index: cl-ppcre/scanner.lisp diff -u cl-ppcre/scanner.lisp:1.1.1.1 cl-ppcre/scanner.lisp:1.2 --- cl-ppcre/scanner.lisp:1.1.1.1 Tue Jan 6 19:58:54 2004 +++ cl-ppcre/scanner.lisp Thu Apr 22 14:53:13 2004 @@ -1,10 +1,10 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/scanner.lisp,v 1.1.1.1 2004/01/07 00:58:54 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/scanner.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; Here the scanner for the actual regex as well as utility scanners ;;; for the constant start and end strings are created. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -37,7 +37,8 @@ (let ((char-compare (if case-insensitive-p 'char-equal 'char=))) `(lambda (start-pos) (declare (type fixnum start-pos)) - (if (> (the fixnum (+ start-pos m)) *end-pos*) + (if (or (minusp start-pos) + (> (the fixnum (+ start-pos m)) *end-pos*)) nil (loop named bmh-matcher for k of-type fixnum = (+ start-pos m -1) @@ -72,11 +73,12 @@ (return-from create-bmh-matcher (lambda (start-pos) (declare (type fixnum start-pos)) - (search pattern - *string* - :start2 start-pos - :end2 *end-pos* - :test test))))) + (and (not (minusp start-pos)) + (search pattern + *string* + :start2 start-pos + :end2 *end-pos* + :test test)))))) (let* ((m (length pattern)) (skip (make-array *regex-char-code-limit* :element-type 'fixnum Index: cl-ppcre/specials.lisp diff -u cl-ppcre/specials.lisp:1.1.1.1 cl-ppcre/specials.lisp:1.2 --- cl-ppcre/specials.lisp:1.1.1.1 Tue Jan 6 19:58:47 2004 +++ cl-ppcre/specials.lisp Thu Apr 22 14:53:13 2004 @@ -1,9 +1,9 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/specials.lisp,v 1.1.1.1 2004/01/07 00:58:47 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/specials.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; globally declared special variables -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions @@ -102,4 +102,25 @@ but large) Boyer-Moore-Horspool matchers.") (defvar *allow-quoting* nil - "Whether the parser should support Perl's \\Q and \\E.") \ No newline at end of file + "Whether the parser should support Perl's \\Q and \\E.") + +(pushnew :cl-ppcre *features*) + +;; stuff for Nikodemus Siivola's HYPERDOC +;; see +;; and + +(defvar *hyperdoc-base-uri* "http://weitz.de/cl-ppcre/") + +(let ((exported-symbols-alist + (loop for symbol being the external-symbols of :cl-ppcre + collect (cons symbol + (concatenate 'string + "#" + (string-downcase symbol)))))) + (defun hyperdoc-lookup (symbol type) + (declare (ignore type)) + (cdr (assoc symbol + exported-symbols-alist + :test #'eq)))) + \ No newline at end of file Index: cl-ppcre/util.lisp diff -u cl-ppcre/util.lisp:1.1.1.1 cl-ppcre/util.lisp:1.2 --- cl-ppcre/util.lisp:1.1.1.1 Tue Jan 6 19:59:06 2004 +++ cl-ppcre/util.lisp Thu Apr 22 14:53:13 2004 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*- -;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/util.lisp,v 1.1.1.1 2004/01/07 00:59:06 eweitz Exp $ +;;; $Header: /project/cl-ppcre/cvsroot/cl-ppcre/util.lisp,v 1.2 2004/04/22 18:53:13 eweitz Exp $ ;;; Utility functions and constants dealing with the hash-tables ;;; we use to encode character classes @@ -7,7 +7,7 @@ ;;; Hash-tables are treated like sets, i.e. a character C is a member of the ;;; hash-table H iff (GETHASH C H) is true. -;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved. +;;; Copyright (c) 2002-2004, Dr. Edmund Weitz. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions From eweitz at common-lisp.net Thu Apr 22 18:53:15 2004 From: eweitz at common-lisp.net (Edi Weitz) Date: Thu, 22 Apr 2004 14:53:15 -0400 Subject: [cl-ppcre-cvs] CVS update: cl-ppcre/doc/index.html Message-ID: Update of /project/cl-ppcre/cvsroot/cl-ppcre/doc In directory common-lisp.net:/tmp/cvs-serv918/doc Modified Files: index.html Log Message: pre-0.7.7, including hyperdoc support Date: Thu Apr 22 14:53:15 2004 Author: eweitz Index: cl-ppcre/doc/index.html diff -u cl-ppcre/doc/index.html:1.1.1.1 cl-ppcre/doc/index.html:1.2 --- cl-ppcre/doc/index.html:1.1.1.1 Tue Jan 6 19:59:20 2004 +++ cl-ppcre/doc/index.html Thu Apr 22 14:53:15 2004 @@ -1229,7 +1229,7 @@ CL-PPCRE together with this documentation can be downloaded from http://weitz.de/files/cl-ppcre.tgz. The -current version is 0.7.1 - older versions are +current version is 0.7.6 - older versions are available for download through URLs like http://weitz.de/files/cl-ppcre-<version>.tgz. A CHANGELOG is available. @@ -1239,9 +1239,9 @@ href="http://packages.debian.org/cgi-bin/search_packages.pl?keywords=cl-ppcre&searchon=names&version=all&release=all">cl-ppcre Debian package which is available thanks to Kevin Rosenberg. There's also a port -for Gentoo Linux thanks to Matthew Kennedy. +for Gentoo Linux thanks to Matthew Kennedy and a FreeBSD port thanks to Henrik Motakef. Installation via asdf-install should also +href="http://www.cliki.net/asdf-install">asdf-install should as well be possible.

CL-PPCRE comes with simple system definitions for and LOAD-TIME-VALUE to make sure that the scanner is only built once if the first argument -to SCAN, SCAN-TO-STRINGS, or -REGEX-REPLACE is a SCAN, SCAN-TO-STRINGS, SPLIT, or +REGEX-REPLACE is a constant form. (But see the notes for *REGEX-CHAR-CODE-LIMIT* and @@ -1927,7 +1927,7 @@ her PowerBook to test CL-PPCRE with MCL and OpenMCL.

-$Header: /project/cl-ppcre/cvsroot/cl-ppcre/doc/index.html,v 1.1.1.1 2004/01/07 00:59:20 eweitz Exp $ +$Header: /project/cl-ppcre/cvsroot/cl-ppcre/doc/index.html,v 1.2 2004/04/22 18:53:15 eweitz Exp $

BACK TO MY HOMEPAGE From eweitz at common-lisp.net Thu Apr 22 18:56:23 2004 From: eweitz at common-lisp.net (Edi Weitz) Date: Thu, 22 Apr 2004 14:56:23 -0400 Subject: [cl-ppcre-cvs] CVS update: cl-ppcre/CHANGELOG cl-ppcre/README cl-ppcre/testdata cl-ppcre/testinput Message-ID: Update of /project/cl-ppcre/cvsroot/cl-ppcre In directory common-lisp.net:/tmp/cvs-serv14657 Modified Files: CHANGELOG README testdata testinput Log Message: pre-0.7.7, including hyperdoc support Date: Thu Apr 22 14:56:22 2004 Author: eweitz Index: cl-ppcre/CHANGELOG diff -u cl-ppcre/CHANGELOG:1.1.1.1 cl-ppcre/CHANGELOG:1.2 --- cl-ppcre/CHANGELOG:1.1.1.1 Tue Jan 6 19:58:44 2004 +++ cl-ppcre/CHANGELOG Thu Apr 22 14:56:22 2004 @@ -1,6 +1,32 @@ -Version ??? -???? +Version 0.7.7 +????-??-?? +Added doc strings for PPCRE-SYNTAX-ERROR and friends (after playing with slime-apropos-package) +Added hyperdoc support + +Version 0.7.6 +2004-04-20 +The closures created by CREATE-BMH-MATCHER now cleanly cope with negative arguments (bug caught by Damien Kick) + +Version 0.7.5 +2004-04-19 +Fixed a bug with constant-length repetitions of . (dot) in single-line mode (caught by RegexCoach user Lee Gold) + +Version 0.7.4 +2004-02-16 +Fixed wrong call to SIGNAL-PPCRE-SIGNAL-ERROR in lexer.lisp (caught by Peter Graves) +Added :CL-PPCRE to *FEATURES* (for CL-INTERPOL) +Compiler macro for SPLIT + +Version 0.7.3 +2004-01-28 +Fixed bug in CURRENT-MIN-REST for lookaheads (reported by Thomas-Paz Hartman) +Added tests for this bug + +Version 0.7.2 +2004-01-27 +Fixed typo (SUBSEQ/NSUBSEQ) in SPLIT (thanks to Alan Ruttenberg) Updated docs with respect to ECL (thanks to Alex Mizrahi) +Mention FreeBSD port in docs Version 0.7.1 2003-10-24 Index: cl-ppcre/README diff -u cl-ppcre/README:1.1.1.1 cl-ppcre/README:1.2 --- cl-ppcre/README:1.1.1.1 Tue Jan 6 19:57:36 2004 +++ cl-ppcre/README Thu Apr 22 14:56:22 2004 @@ -1,6 +1,10 @@ Complete documentation for CL-PPCRE can be found in the 'doc' directory. +CL-PPCRE also supports Nikodemus Siivola's HYPERDOC, see + and +. + 1. Installation 1.1. Probably the easiest way is Index: cl-ppcre/testdata diff -u cl-ppcre/testdata:1.1.1.1 cl-ppcre/testdata:1.2 --- cl-ppcre/testdata:1.1.1.1 Tue Jan 6 19:58:42 2004 +++ cl-ppcre/testdata Thu Apr 22 14:56:22 2004 @@ -14283,3 +14283,6 @@ (1622 "\"aa\" =~ /(?x)a#\\Q ./" "(?x)a#\\Q ." nil nil nil nil "aa" nil 1 0 nil nil) +(1623 "\"abcdxklqj\" =~ /ab(?=.*q)cd/" "ab(?=.*q)cd" nil nil nil nil "abcdxklqj" nil 1 0 "abcd" (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)) +(1624 "\"ab\" =~ /a(?!.*$)b/" "a(?!.*$)b" nil nil nil nil "ab" nil 1 0 nil nil) +(1625 "\"Axi\" =~ /.{2}[a-z]/" ".{2}[a-z]" nil nil nil nil "Axi" nil 1 0 "Axi" (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)) Index: cl-ppcre/testinput diff -u cl-ppcre/testinput:1.1.1.1 cl-ppcre/testinput:1.2 --- cl-ppcre/testinput:1.1.1.1 Tue Jan 6 19:59:11 2004 +++ cl-ppcre/testinput Thu Apr 22 14:56:22 2004 @@ -3936,4 +3936,13 @@ /(?x)a#\Q ./ a. - aa \ No newline at end of file + aa + +/ab(?=.*q)cd/ + abcdxklqj + +/a(?!.*$)b/ + ab + +/.{2}[a-z]/ + Axi \ No newline at end of file From root at common-lisp.net Fri Apr 23 13:03:13 2004 From: root at common-lisp.net (root) Date: Fri, 23 Apr 2004 09:03:13 -0400 Subject: [cl-ppcre-cvs] CVS update: CVSROOT/config Message-ID: Update of /project/cl-ppcre/cvsroot/CVSROOT In directory common-lisp.net:/tmp/d/CVSROOT Modified Files: config Log Message: fixing anon cvs Date: Fri Apr 23 09:03:13 2004 Author: root Index: CVSROOT/config diff -u CVSROOT/config:1.1 CVSROOT/config:1.2 --- CVSROOT/config:1.1 Tue Jan 6 11:26:55 2004 +++ CVSROOT/config Fri Apr 23 09:03:12 2004 @@ -2,7 +2,7 @@ #SystemAuth=no # Put CVS lock files in this directory rather than directly in the repository. -#LockDir=/var/lock/cvs +LockDir=/var/lock/cl-ppcre # Set `TopLevelAdmin' to `yes' to create a CVS directory at the top # level of the new working directory when using the `cvs checkout' From eweitz at common-lisp.net Sat Apr 24 21:41:27 2004 From: eweitz at common-lisp.net (Edi Weitz) Date: Sat, 24 Apr 2004 17:41:27 -0400 Subject: [cl-ppcre-cvs] CVS update: cl-ppcre/doc/index.html Message-ID: Update of /project/cl-ppcre/cvsroot/cl-ppcre/doc In directory common-lisp.net:/tmp/cvs-serv13499/doc Modified Files: index.html Log Message: oops - hyperdoc link for create-scanner was wrong Date: Sat Apr 24 17:41:27 2004 Author: eweitz Index: cl-ppcre/doc/index.html diff -u cl-ppcre/doc/index.html:1.2 cl-ppcre/doc/index.html:1.3 --- cl-ppcre/doc/index.html:1.2 Thu Apr 22 14:53:15 2004 +++ cl-ppcre/doc/index.html Sat Apr 24 17:41:27 2004 @@ -122,7 +122,7 @@

  1. How to use CL-PPCRE
      -
    1. create-scanner (for Perl regex strings) +
    2. create-scanner (for Perl regex strings)
    3. create-scanner (for parse trees)
    4. scan
    5. scan-to-strings @@ -181,7 +181,7 @@ CL-PPCRE exports the following symbols:


      [Function] -
      create-scanner string &key case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive => scanner +
      create-scanner string &key case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive => scanner


      Accepts a string which is a regular expression in Perl syntax and returns a closure which will scan strings for this @@ -241,7 +241,7 @@
      create-scanner parse-tree &key case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive => scanner

      This is similar to CREATE-SCANNER above but +href="#create-scanner">CREATE-SCANNER above but accepts a parse tree as its first argument. A parse tree is an S-expression conforming to the following syntax: @@ -1052,7 +1052,7 @@
      *use-bmh-matchers*

      Usually, the scanners created by CREATE-SCANNER (or +href="#create-scanner">CREATE-SCANNER (or implicitely by other functions and macros) will use fast Boyer-Moore-Horspool matchers to check for constant strings at the start or end of the @@ -1210,7 +1210,7 @@ convert a parse tree). This might be particularly useful when *ALLOW-QUOTING* is true because in this case the offending string might not be the one you gave to the CREATE-SCANNER function. +href="#create-scanner">CREATE-SCANNER function.


      [Function] @@ -1927,7 +1927,7 @@ her PowerBook to test CL-PPCRE with MCL and OpenMCL.

      -$Header: /project/cl-ppcre/cvsroot/cl-ppcre/doc/index.html,v 1.2 2004/04/22 18:53:15 eweitz Exp $ +$Header: /project/cl-ppcre/cvsroot/cl-ppcre/doc/index.html,v 1.3 2004/04/24 21:41:27 eweitz Exp $

      BACK TO MY HOMEPAGE