Fix some typos
This commit is contained in:
parent
0a73cf3295
commit
3fc927fee8
16
parse.lisp
16
parse.lisp
@ -163,13 +163,19 @@ non-nil, allow names to be more than one character long."
|
||||
finally
|
||||
(let ((str (coerce token 'string)))
|
||||
(return
|
||||
;; the multi-char token is an operator. its a variable, so defer
|
||||
;; to multi-char-names
|
||||
(if (or multi-char-names
|
||||
(string
|
||||
(cond
|
||||
;; single character unary operand
|
||||
((let ((val (operator-symbol (string (first token)))))
|
||||
(and (symbolp val) (unary-p val)))
|
||||
(first token))
|
||||
;; multi-char variable, constant (true or false), or operator
|
||||
((or multi-char-names
|
||||
(operator-symbol str)
|
||||
(symbolp (interpret-operand str)))
|
||||
str
|
||||
(string (first token)))))))
|
||||
str)
|
||||
;; single letter variable (multi-char-names is off)
|
||||
(t (first token))))))))
|
||||
|
||||
(defun next-token (str &key multi-char-names)
|
||||
"Return a list of the next token in STR and how much whitespace it had."
|
||||
|
31
typeset.lisp
31
typeset.lisp
@ -109,7 +109,7 @@
|
||||
else
|
||||
collect char)))
|
||||
|
||||
(defun typeset-proposition (expr &optional
|
||||
(defun typeset-proposition (expr &key
|
||||
(lookup-table *operator-ascii-lookup-alist*)
|
||||
var-name-transform
|
||||
(parent-prec most-positive-fixnum))
|
||||
@ -143,19 +143,25 @@ use (it controls when parentheses are applied.)"
|
||||
(if (null args)
|
||||
;; we have one argument
|
||||
(format nil "~A~A~A~A" (car prefix-suffix) oper-ascii
|
||||
(typeset-proposition first-arg lookup-table
|
||||
var-name-transform our-prec)
|
||||
(typeset-proposition first-arg
|
||||
:lookup-table lookup-table
|
||||
:var-name-transform var-name-transform
|
||||
:parent-prec our-prec)
|
||||
(cdr prefix-suffix))
|
||||
;; we have many arguments
|
||||
(loop for arg in args
|
||||
collect oper-ascii into output
|
||||
collect
|
||||
(typeset-proposition arg lookup-table
|
||||
var-name-transform our-prec)
|
||||
(typeset-proposition arg
|
||||
:lookup-table lookup-table
|
||||
:var-name-transform var-name-transform
|
||||
:parent-prec our-prec)
|
||||
into output
|
||||
finally
|
||||
(push (typeset-proposition first-arg lookup-table
|
||||
var-name-transform our-prec)
|
||||
(push (typeset-proposition first-arg
|
||||
:lookup-table lookup-table
|
||||
:var-name-transform var-name-transform
|
||||
:parent-prec our-prec)
|
||||
output)
|
||||
(return (format nil "~A~{~A~^ ~}~A" (car prefix-suffix)
|
||||
output (cdr prefix-suffix))))))))))
|
||||
@ -168,8 +174,8 @@ NOTE: though the overall order does not matter, the order must be the same
|
||||
between each row."
|
||||
(let ((typeset-exprs (mapcar (lambda (expr)
|
||||
(typeset-proposition
|
||||
expr *operator-latex-lookup-alist*
|
||||
'latex-var-name-transform))
|
||||
expr :lookup-table *operator-latex-lookup-alist*
|
||||
:var-name-transform 'latex-var-name-transform))
|
||||
(extract-truth-table-expressions table))))
|
||||
(format nil "~
|
||||
\\begin{tabular}{~{~*|c~}|}~
|
||||
@ -200,8 +206,8 @@ NOTE: though the overall order does not matter, the order must be the same
|
||||
between each row."
|
||||
(let ((typeset-exprs (mapcar (lambda (expr)
|
||||
(typeset-proposition
|
||||
expr *operator-html-lookup-alist*
|
||||
'html-var-name-transform))
|
||||
expr :lookup-table *operator-html-lookup-alist*
|
||||
:var-name-transform 'html-var-name-transform))
|
||||
(extract-truth-table-expressions table))))
|
||||
(format nil "~
|
||||
<table~@[ class=~s~]~@[ id=~s~]~{ ~A~}>~
|
||||
@ -274,7 +280,8 @@ length of each column."
|
||||
NOTE: though the overall order does not matter, the order must be the same
|
||||
between each row."
|
||||
(let* ((typeset-exprs (mapcar (lambda (expr)
|
||||
(typeset-proposition expr expr-lookup-table))
|
||||
(typeset-proposition
|
||||
expr :lookup-table expr-lookup-table))
|
||||
(extract-truth-table-expressions table)))
|
||||
(col-widths (mapcar (lambda (expr)
|
||||
(+ (length expr) 2))
|
||||
|
Loading…
Reference in New Issue
Block a user