From 7d0c41eed95bb9b998f5fd8089db6f29b45fea0e Mon Sep 17 00:00:00 2001 From: cage Date: Wed, 19 Jun 2024 17:50:37 +0200 Subject: [PATCH] - prefixed all parsing rule for tour parsing to avoid clash with other rules in the code. --- src/gopher/parser.lisp | 4 ++-- src/tour-mode-parser.lisp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gopher/parser.lisp b/src/gopher/parser.lisp index 344bb2b..2127eac 100644 --- a/src/gopher/parser.lisp +++ b/src/gopher/parser.lisp @@ -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)) diff --git a/src/tour-mode-parser.lisp b/src/tour-mode-parser.lisp index 71061e8..8f64945 100644 --- a/src/tour-mode-parser.lisp +++ b/src/tour-mode-parser.lisp @@ -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))