Fix incorrect parenthesis
This commit is contained in:
21
parse.lisp
21
parse.lisp
@ -108,26 +108,9 @@ proposition."))
|
||||
(open-paren most-positive-fixnum)
|
||||
(t nil)))
|
||||
|
||||
(defun operator-argument-count (oper)
|
||||
"Return the minimum number of arguments that OPER takes as the first value,
|
||||
and the maximum number (or nil for infinity) as a second value."
|
||||
(case oper
|
||||
(and (values 2 nil))
|
||||
(or (values 2 nil))
|
||||
(xor (values 2 nil))
|
||||
(not (values 1 1))
|
||||
(implies (values 2 2))
|
||||
(converse (values 2 2))
|
||||
(iff (values 2 2))
|
||||
(nand (values 2 nil))
|
||||
(nor (values 2 2))
|
||||
(open-paren (values 0 0))
|
||||
(t (error "unknown operator: ~S" oper))))
|
||||
|
||||
(defun unary-p (oper)
|
||||
"Return whether OPER is a unary operator or not."
|
||||
(when oper
|
||||
(= 1 (operator-argument-count oper))))
|
||||
(eq oper 'not))
|
||||
|
||||
(defun interpret-operand (oper-str)
|
||||
"Return a symbol representing OPER-STR, or the string itself if it represents
|
||||
@ -267,7 +250,7 @@ found variables."
|
||||
(error 'proposition-parse-error :message "no more operators"
|
||||
:position pos
|
||||
:proposition prop-str))
|
||||
(let ((oper-args (operator-argument-count oper))
|
||||
(let ((oper-args (if (unary-p oper) 1 2))
|
||||
(cur-operands (list (pop operands))))
|
||||
(when (not (car cur-operands))
|
||||
(error 'proposition-parse-error
|
||||
|
Reference in New Issue
Block a user