Fix parser
This commit is contained in:
10
parse.lisp
10
parse.lisp
@ -90,12 +90,12 @@ proposition."))
|
||||
"Return t if STR is only alphabetical characters."
|
||||
(not (find-if-not 'alpha-char-p str)))
|
||||
|
||||
(defparameter *longest-non-alpha-operator*
|
||||
(defparameter *longest-alpha-operator*
|
||||
(apply 'max (mapcar
|
||||
(lambda (entry)
|
||||
(apply 'max
|
||||
(apply 'max 0
|
||||
(mapcar 'length
|
||||
(remove-if 'alpha-string-p (cdr entry)))))
|
||||
(remove-if-not 'alpha-string-p (cdr entry)))))
|
||||
*operator-symbol-table*))
|
||||
"The longest operator in `*operator-symbol-table*' such that `alpha-string-p'
|
||||
returns t.")
|
||||
@ -224,7 +224,7 @@ a variable."
|
||||
"Return the operator symbol for TOKEN, if it is an operator. As a second
|
||||
value, return the matched portion of TOKEN. If no match is found, return
|
||||
(values nil nil)."
|
||||
(loop for len downfrom (min *longest-non-alpha-operator* (length token)) to 1
|
||||
(loop for len downfrom (min *longest-alpha-operator* (length token)) to 1
|
||||
for cur-test = (subseq token 0 len)
|
||||
for oper-sym = (operator-symbol cur-test)
|
||||
when oper-sym do
|
||||
@ -446,7 +446,7 @@ found variables."
|
||||
(push-operator value token-pos)))))
|
||||
;; remove implicit-and
|
||||
(when (eq 'implicit-and (peek-operator))
|
||||
(pop-operator))
|
||||
(pop-operator))
|
||||
(loop for (top-oper . top-pos) = (car operators)
|
||||
while top-oper
|
||||
when (eq top-oper 'open-paren) do
|
||||
|
Reference in New Issue
Block a user