Changeset trunk,11 for trunk/parse3.lisp


Ignore:
Timestamp:
06/18/2007 07:51:03 PM (19 years ago)
Author:
dsowen
revision id:
svn-v3-trunk0:2948df59-2b31-0410-8e06-c40c0b09d5b6:trunk:11
Message:

Expanded CSV example.
Fixed: IF-MATCHES-PARSER was misspelled as IF-MATCHER-PARSER.
Adjusted tree construction for sequence matching.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/parse3.lisp

    r10 r11  
    44    ,@body))
    55
    6 (defmacro if-matcher-parser (input parser (next match)
     6(defmacro if-matches-parser (input parser (next match)
    77                             &body (&optional (then t) else))
    88  (declare (symbol parser next match))
     
    6666          `(if-matches ,input ,head (,head-next ,head-match)
    6767            (if-matches-sequence ,head-next ,tail (,next ,tail-match)
    68               (let ((,match (cons ,head-match (list ,tail-match))))
     68              (let ((,match (cons ,head-match ,tail-match)))
    6969                ,then)
    7070              ,else)
    7171            ,else))
    72         `(if-matches ,input ,head (,next ,match) ,then ,else))))
     72        (with-gensyms (tail-match)
     73          `(if-matches ,input ,head (,next ,tail-match)
     74            (let ((,match (list ,tail-match)))
     75              ,then)
     76            ,else)))))
    7377
    7478(defmacro if-matches-eqcount (input count rule (next match)
     
    149153(defmacro if-matches (input rule (next match) &body (&optional (then t) else))
    150154  (etypecase rule
    151     (symbol `(if-matcher-parser ,input ,rule (,next ,match) ,then ,else))
     155    (symbol `(if-matches-parser ,input ,rule (,next ,match) ,then ,else))
    152156    (character `(if-matches-char ,input ,rule (,next ,match) ,then ,else))
    153157    (string `(if-matches-string ,input ,rule (,next ,match) ,then ,else))
Note: See TracChangeset for help on using the changeset viewer.