Changeset trunk,25 for trunk


Ignore:
Timestamp:
06/25/2007 07:37:09 PM (19 years ago)
Author:
dsowen
revision id:
svn-v3-trunk0:2948df59-2b31-0410-8e06-c40c0b09d5b6:trunk:27
Message:

Fixed: Error if first rule in sequence is a nest rule, like ((...) ...).
Export defparser and defgrammar.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/matching.lisp

    r24 r25  
    234234    (list
    235235     (destructuring-bind (head . tail) rule
    236        (symcase head
    237          (^ (destructuring-bind (regex) tail
    238               `(if-matches-regex ,input ,regex (,next ,match) ,then ,else)))
    239          (/ `(if-matches-choice ,input ,tail (,next ,match) ,then ,else))
    240          ({} (destructuring-bind (mincount maxcount subrule) tail
    241                `(if-matches-count ,input ,mincount ,maxcount ,subrule
    242                  (,next ,match) ,then ,else)))
    243          (* (destructuring-bind (sub) tail
    244               `(if-matches-count ,input 0 nil ,sub (,next ,match)
    245                 ,then ,else)))
    246          (? (destructuring-bind (sub) tail
    247               `(if-matches-count ,input 0 1 ,sub (,next ,match) ,then ,else)))
    248          (+ (destructuring-bind (sub) tail
    249               `(if-matches-count ,input 1 nil ,sub (,next ,match)
    250                 ,then ,else)))
    251          (& (destructuring-bind (sub) tail
    252               `(if-matches-required ,input ,sub (,next ,match) ,then ,else)))
    253          (! (destructuring-bind (sub) tail
    254               `(if-matches-forbidden ,input ,sub (,next ,match) ,then ,else)))
    255          (= (destructuring-bind (sub) tail
    256               `(if-matches-only ,input ,sub (,next ,match) ,then ,else)))
    257          (t `(if-matches-sequence ,input ,rule (,next ,match)
    258               ,then ,else)))))))
     236       (if (symbolp head)
     237           (symcase head
     238             (^ (destructuring-bind (regex) tail
     239                  `(if-matches-regex ,input ,regex (,next ,match)
     240                    ,then ,else)))
     241             (/ `(if-matches-choice ,input ,tail (,next ,match) ,then ,else))
     242             ({} (destructuring-bind (mincount maxcount subrule) tail
     243                   `(if-matches-count ,input ,mincount ,maxcount ,subrule
     244                     (,next ,match) ,then ,else)))
     245             (* (destructuring-bind (sub) tail
     246                  `(if-matches-count ,input 0 nil ,sub (,next ,match)
     247                    ,then ,else)))
     248             (? (destructuring-bind (sub) tail
     249                  `(if-matches-count ,input 0 1 ,sub (,next ,match)
     250                    ,then ,else)))
     251             (+ (destructuring-bind (sub) tail
     252                  `(if-matches-count ,input 1 nil ,sub (,next ,match)
     253                    ,then ,else)))
     254             (& (destructuring-bind (sub) tail
     255                  `(if-matches-required ,input ,sub (,next ,match)
     256                    ,then ,else)))
     257             (! (destructuring-bind (sub) tail
     258                  `(if-matches-forbidden ,input ,sub (,next ,match)
     259                    ,then ,else)))
     260             (= (destructuring-bind (sub) tail
     261                  `(if-matches-only ,input ,sub (,next ,match) ,then ,else)))
     262             (t `(if-matches-sequence ,input ,rule (,next ,match)
     263                  ,then ,else)))
     264           `(if-matches-sequence ,input ,rule (,next ,match) ,then ,else))))))
  • trunk/package.lisp

    r21 r25  
    3535           #:if-matches-forbidden
    3636           #:if-matches-only
    37            #:if-matches))
     37           #:if-matches
     38           #:defparser
     39           #:defgrammar))
Note: See TracChangeset for help on using the changeset viewer.