mirror of https://codeberg.org/cage/tinmop/
- prefixed all parsing rule for tour parsing to avoid clash with other rules in the code.
This commit is contained in:
parent
a708977646
commit
7d0c41eed9
|
@ -276,7 +276,7 @@
|
|||
(:function first))
|
||||
|
||||
(defun parse-menu (data)
|
||||
(let ((menu (parse 'menu data)))
|
||||
(let ((menu (parse 'gopher-menu data)))
|
||||
(loop for entry in menu
|
||||
collect
|
||||
(let* ((line-type (getf entry :type))
|
||||
|
@ -371,7 +371,7 @@
|
|||
(list host port path type)))))
|
||||
|
||||
(defun parse-iri (iri)
|
||||
(let* ((parsed (parse 'gopher-url iri))
|
||||
(let* ((parsed (parse 'gopher-gopher-url iri))
|
||||
(host (first parsed))
|
||||
(port (second parsed))
|
||||
(selector (third parsed))
|
||||
|
|
|
@ -19,27 +19,27 @@
|
|||
|
||||
(define-constant +-separator+ "/" :test #'string=)
|
||||
|
||||
(defrule digit (character-ranges (#\0 #\9))
|
||||
(defrule tour-digit (character-ranges (#\0 #\9))
|
||||
(:text t))
|
||||
|
||||
(defrule range-delimter #\-)
|
||||
(defrule tour-range-delimter #\-)
|
||||
|
||||
(defrule list-delimiter (+ (or #\Space #\,)))
|
||||
(defrule tour-list-delimiter (+ (or #\Space #\,)))
|
||||
|
||||
(defrule number (and digit (* digit))
|
||||
(defrule tour-number (and tour-digit (* tour-digit))
|
||||
(:text t)
|
||||
(:function parse-integer))
|
||||
|
||||
(defstruct range from to)
|
||||
|
||||
(defrule range (and number range-delimter number)
|
||||
(defrule tour-range (and tour-number tour-range-delimter tour-number)
|
||||
(:function (lambda (a) (make-range :from (first a) :to (third a)))))
|
||||
|
||||
(defrule tour-tail (? (and list-delimiter tour))
|
||||
(defrule tour-tour-tail (? (and tour-list-delimiter tour-tour))
|
||||
(:function rest))
|
||||
|
||||
(defrule tour (and (or range number) tour-tail)
|
||||
(defrule tour-tour (and (or tour-range tour-number) tour-tour-tail)
|
||||
(:function flatten))
|
||||
|
||||
(defun parse-tour-mode (data)
|
||||
(parse 'tour data))
|
||||
(parse 'tour-tour data))
|
||||
|
|
Loading…
Reference in New Issue