Changeset 19 for trunk/example.lisp


Ignore:
Timestamp:
02/27/2008 05:56:24 AM (18 years ago)
Author:
dsowen
Message:
  • Added LEX-ALL helper function.
  • Added longest-match logic.
  • Updated documentation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/example.lisp

    r18 r19  
    2929(defun un-dquote (s) (regex-replace-all "\"\"" (snip s) "\""))
    3030
    31 (deflexer scan-csv
     31(deflexer scan-csv (:priority-only t)
    3232  ("," comma)
    3333  ("[^\"',]+" value)
     
    3535  ("\"(?:[^\"]|\"\")*\"" value un-dquote))
    3636
    37 (defun scan-all (input)
    38   (labels ((scan (start tokens)
    39              (if (> (length input) start)
    40                  (multiple-value-bind (class image remainder)
    41                      (scan-csv input start)
    42                    (when class
    43                      (scan remainder (cons (cons class image) tokens))))
    44                  (nreverse tokens))))
    45     (scan 0 '())))
    4637
    47 (scan-all "no quotes,'a ''quote''',\"another \"\"quote\"\"\"")
     38
     39(lex-all 'scan-csv "no quotes,'a ''quote''',\"another \"\"quote\"\"\"")
Note: See TracChangeset for help on using the changeset viewer.