Codebase list cafeobj / 6feef4d
Fix: when term parser selects among possible parses, there can be ones of built-in constants. tswd 11 years ago
1 changed file(s) with 21 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
217217 (defun pre-choose-final (module final)
218218 (declare (type module module)
219219 (type list final))
220 (let ((mslist (mapcar #'(lambda (x) (term-head x)) final))
221 (least-op nil)
222 (gen-op nil)
223 (res nil))
224 (let ((*current-sort-order* (module-sort-order module))
225 (*current-opinfo-table* (module-opinfo-table module)))
226 ;; first find the lowest one
227 (setq least-op (choose-lowest-op mslist))
228 (when least-op
229 (push (find-if #'(lambda (x) (method= least-op (term-head x)))
230 final)
231 res)
232 (return-from pre-choose-final res))
233 ;; then select most general one
234 (setq gen-op (choose-most-general-op mslist))
235 (when gen-op
236 (push (find-if #'(lambda (x) (method= gen-op (term-head x))) final)
237 res)
238 (return-from pre-choose-final res))
239 ;; could not find
240 (pre-choose-final-sub module final))))
220 (when (every #'term-is-application-form? final)
221 (let ((mslist (mapcar #'(lambda (x) (term-head x)) final))
222 (least-op nil)
223 (gen-op nil)
224 (res nil))
225 (with-in-module (module)
226 ;; first find the lowest one
227 (setq least-op (choose-lowest-op mslist))
228 (when least-op
229 (push (find-if #'(lambda (x) (method= least-op (term-head x)))
230 final)
231 res)
232 (return-from pre-choose-final res))
233 ;; then select most general one
234 (setq gen-op (choose-most-general-op mslist))
235 (when gen-op
236 (push (find-if #'(lambda (x) (method= gen-op (term-head x))) final)
237 res)
238 (return-from pre-choose-final res)))))
239 ;; could not find
240 (pre-choose-final-sub module final))
241241
242242 ;;; NOT USED NOW.
243243 (defun parser-diagnose (module preterm sort)