TEX-HTML-TEX-PARSING> (esrap-peg:def-peg-matchers
(
(Text ((_ ?x) (s+ (m! #'! (m! #'n2 ?x)))))
(Paragraph
((?x _) (concatenate 'string (s+ (m! #'! ?x)) "$")))
(Entry (_ (! x)))
(InParagraphEntry ((_ ?x) (! ?x)))
(FormulaFriendlyEntry (_ (! x)))
(MissedOperator (_ (if *in-formula* (format nil "\\~a" x) x)))
(UniversallyFriendlyEntry (_ (! x)))
(PlainGroup
((_ (_ (?x . ?y) _)) (! `(tex-html-tex-parsing::HPPG (,(! ?x) ,?y))))
((_ (_ nil _)) (if *in-formula* "{}" ""))
)
(HPPG
(("\\it " ?y)
(! `(tex-html-tex-parsing::PPG
("\\it " . ,(let ((*in-formula* nil)) (m! #'! ?y))))))
(("\\bf " ?y)
(! `(tex-html-tex-parsing::PPG
("\\bf " . ,(let ((*in-formula* nil)) (m! #'! ?y))))))
((?x ?y) (! `(tex-html-tex-parsing::PPG (,?x . ,(m! #'! ?y)))))
)
(PPG
(("\\it " . ?x)
(if *in-formula*
(progn
(format t "In context: ~s~%\\it instead of \\mbox: ~s~%"
x *current-context*)
(format nil "{\\mbox{~{~a~}}}" ?x)
)
(format nil "~{~a~}" ?x)
))
(("\\bf " . ?x)
(if *in-formula*
(progn
(format t "In context: ~s~%\\bf instead of \\mbox: ~s~%"
x *current-context*)
(format nil "{\\mbox{~{~a~}}}" ?x)
)
(format nil "~{~a~}" ?x)
))
(_ (format nil "{~{~a~}}" x)))
(Group ((_ ?x _) (s+ (m! #'! ?x))))
(ProxyAssumedPlainTextChar
(_ (! `(,(if *in-formula*
'tex-html-tex-parsing::FormulaStrangeChar
'tex-html-tex-parsing::AssumedPlainTextChar
) ,x))))
(CommaDecimal
((?x _ ?y)
(if *in-formula*
(format nil "~{~a~}{,}~{~a~}" ?x ?y)
(format nil "~{~a~},~{~a~}" ?x ?y))))
(ProxyAssumedPlainTextChar
(_
(if *in-formula*
(or
(! (list 'tex-html-tex-parsing::FormulaTransChar (n2 x)))
(! (list 'tex-html-tex-parsing::FormulaStrangeChar (n2 x)))
)
(! (list 'tex-html-tex-parsing::AssumedPlainTextChar x))
)))
(FormulaStrangeChar
(_ (progn (format t "Strange char in formula: ~s in context ~s~%"
x *current-context*) "!")))
(AssumedPlainTextChar
((_ "<") (if *in-formula* "\\lt " "<"))
((_ ">") (if *in-formula* "\\gt " ">"))
((_ " ") (if *in-formula* "" " "))
((_ ?x) ?x))
(TextTilde
(_ (if *in-formula* "~" " ")))
(TextRatio
((?x _ ?y ?z) (format nil "~a:~a~a" (s+ ?x) ?y (s+ ?z))))
(FormulaPlainTextChar
(_ (! `(tex-html-tex-parsing::AssumedPlainTextChar (nil ,x)))))
(FormulaTransChar
(_ (second (find x '(
("А" "A")
("В" "B")
("Е" "E")
("К" "K")
("М" "M")
("Н" "H")
("О" "O")
("Р" "P")
("С" "C")
("Т" "T")
("У" "Y")
("Х" "X")
("а" "a")
("е" "e")
("о" "o")
("р" "p")
("с" "c")
("у" "y")
("х" "x")
("\"" "''")
) :test 'equal :key 'first))))
(EOL (_ (if *in-formula* "" " ")))
(WhiteSpace (_ " "))
(WhiteSpaceToKill (_ ""))
(EOLToKill (_ ""))
(Comment (_ ""))
(DisplayFormula
((_ ?x _) (concatenate 'string "$" (let* ((*in-formula* t)) (! ?x)) "$")))
(InlineFormula
((_ ?x _) (concatenate 'string "" (let* ((*in-formula* t)) (! ?x)) "")))
(Command
(((tex-html-tex-parsing::LongCommand
("\\" ("t" "e" "x" "t" "i" "t"))) _ _ ?x _)
(concatenate 'string "" (! (n1 ?x)) ""))
(((tex-html-tex-parsing::LongCommand
(nil "\\" ("h" "b" "o" "x"))) _ _ ?x _)
(! `(tex-html-tex-parsing::ProcessedCommand
("\\mbox" nil (,(let ((*in-formula* nil))(! (n1 ?x)))))
)))
(((tex-html-tex-parsing::LongCommand
(nil "\\" ("m" "b" "o" "x"))) _ _ ?x _)
(! `(tex-html-tex-parsing::ProcessedCommand
("\\mbox" nil (,(let ((*in-formula* nil))(! (n1 ?x)))))
)))
(((tex-html-tex-parsing::OneCharCommand
("\\" nil "'")) _ nil
((TEX-HTML-TEX-PARSING::MANDATORYARGUMENT
(NIL
(TEX-HTML-TEX-PARSING::GROUP
("{"
((TEX-HTML-TEX-PARSING::INPARAGRAPHENTRY
(NIL
?x)))
"}"))))) _)
(format nil "\\'~a" (! ?x)))
(((tex-html-tex-parsing::OneCharCommand
("\\" nil " ")) _ nil nil _)
(if *in-formula* "\\ " " "))
(((tex-html-tex-parsing::OneCharCommand
("\\" nil ?x)) _ nil nil _)
(format nil "\\~a" ?x))
((?x _ ?y ?z ?u)
(! `(tex-html-tex-parsing::ProcessedCommand
(,(! ?x) ,(m! #'! ?y) ,(m! #'! ?z) ,?u)))))
(NoArgCommand ((_ ?x _) (format nil "\\~a " ?x)))
(ProcessedCommand
(("\\textit" _ (?x . _)) (concatenate 'string "" ?x ""))
(("\\begin" _ ("center")) "")
(("\\end" _ ("center")) "")
(("\\mbox" _ (#.(unify:make-template
'string '(string #\\ #\i #\t #\Space &rest ?x))) _)
(if *in-formula*
(progn (format t "In context: ~s~%\\it in mbox: ~s~%" *current-context* x)
(format nil "\\mbox{~a}" ?x))
(format nil "\\hbox{\\it ~a}" ?x)
))
(("\\ldots" . _) (if *in-formula* (concatenate 'string (first x) " ")
(progn (format t "In context: ~s~%Dots in text: ~s~%" *current-context* x) "…")))
(("\\cdots" . _) (if *in-formula* (concatenate 'string (first x) " ")
(progn (format t "In context: ~s~%Dots in text: ~s~%" *current-context* x) "")))
(("\\dots" . _) (if *in-formula* (concatenate 'string (first x) " ")
(progn (format t "In context: ~s~%Dots in text: ~s~%" *current-context* x) "…")))
(("\\ddots" . _) (if *in-formula* (concatenate 'string (first x) " ")
(progn (format t "In context: ~s~%Dots in text: ~s~%" *current-context* x) "")))
(("\\vdots" . _) (if *in-formula* (concatenate 'string (first x) " ")
(progn (format t "In context: ~s~%Dots in text: ~s~%" *current-context* x) "")))
(("\\pdots" . _) (if *in-formula* (concatenate 'string (first x) " ")
(progn (format t "In context: ~s~%Dots in text: ~s~%" *current-context* x) "")))
(("\\-" _ _) "")
(("\\-" _ _ _) "")
((?x ?y ?z ?u)
(format nil "~a~{[~a]~}~{{~a}~}~a" ?x (m! #'! ?y) ?z (if (or ?y ?z (and *in-formula* (not ?u))) "" " ")))
((?x ?y ?z)
(format nil "~a~{[~a]~}~{{~a}~}~a" ?x (m! #'! ?y) ?z (if (or ?y ?z (and *in-formula*)) "" " ")))
)
(Environment
((_ _ _ ?name _ ?opta ?stricta ?cont _ _ _ ?name _)
(! `(tex-html-tex-parsing::ParsedEnvironment
(,(s+ ?name) ,(m! #'! ?opta) ,(m! #'! ?stricta) ,(m! #'! ?cont))
))))
(Root
((_ _ ?n _ ?x) (format nil "\\sqrt[~{~a~}]{~a}" (m! #'! (m! #'n2 (n2 ?n))) (! (n2 (n2 ?x))))))
(LeftRight
((_ (_ (_ ?left)) _ ?cont _ (_ (_ ?right)) _)
(! `(tex-html-tex-parsing::ParsedLeftRight
(,(! ?left) ,(! ?right) ,?cont)))))
(ParsedEnvironment
((?name ?opta ?stricta ?cont) (s+ ?cont))
)
(ParsedLeftRight
(("{" "." ((_ (_ (tex-html-tex-parsing::Environment (_ _ _ ("a" "r" "r" "a" "y") . _)))) . _))
(format
nil "\\syst{~{~a~}}"
(cons (! (n1 (n3 x)))
(let ((*in-formula* t)) (m! #'! (cdr (n3 x)))))))
(("\\{" "." ((_ (_ (tex-html-tex-parsing::Environment (_ _ _ ("a" "r" "r" "a" "y") . _)))) . _))
(format
nil "\\syst{~{~a~}}"
(cons (! (n1 (n3 x)))
(let ((*in-formula* t)) (m! #'! (cdr (n3 x)))))))
(("\\{ " "." ((_ (_ (tex-html-tex-parsing::Environment (_ _ _ ("a" "r" "r" "a" "y") . _)))) . _))
(format
nil "\\syst{~{~a~}}"
(cons (! (n1 (n3 x)))
(let ((*in-formula* t)) (m! #'! (cdr (n3 x)))))))
(("[" "." ((_ (_ (tex-html-tex-parsing::Environment (_ _ _ ("a" "r" "r" "a" "y") . _)))) . _))
(format
nil "\\sovok{~{~a~}}"
(cons (! (n1 (n3 x)))
(let ((*in-formula* t)) (m! #'! (cdr (n3 x)))))))
((?x ?y ?cont)
(format nil "\\left~a~a~{~a~}\\right~a~a" (if (cl-ppcre:scan "^[A-Za-z]" ?x) " " "") ?x
(m! #'! ?cont) (if (cl-ppcre:scan "^[A-Za-z]" ?y) " " "") ?y)))
(StrangeEater (_ ""))
(OptionalArgument
((_ _ ?x _) (s+ (m! #'n2 ?x))))
(MandatoryArgument (_ (! (n2 x))))
(OneCharCommand
(("\\" _ "&") "\\amp ")
(("\\" _ "|") "\\Vert ")
(_ (concatenate 'string (n1 x) (n3 x))))
(LongCommand
((_ "\\" ?x) (s+ (cons "\\" ?x))))
(Formula (_ (s+ (m! #'! x))))
(ParagraphBreak (_ "$"))
)
:abbreviations
(
(! (x) (esrap-peg:ast-eval x))
(n1 (x) (first x)) (n2 (x) (second x)) (n3 (x) (third x))
(n4 (x) (fourth x)) (n5 (x) (fifth x)) (n6 (x) (sixth x))
(n7 (x) (seventh x)) (n8 (x) (eighth x)) (n9 (x) (ninth x))
(s+ (x) (apply 'concatenate 'string x))
(l+ (x) (apply 'append x))
(m! (f x) (mapcar f x))
)
:arg x
:package :tex-html-tex-parsing)
; in: ESRAP-PEG:DEF-PEG-FUN PARSEDENVIRONMENT
; (LET ((TEX-HTML-TEX-PARSING::?CONT
; (IT.UNIMIB.DISCO.MA.CL.EXT.DACF.UNIFICATION:FIND-VARIABLE-VALUE
; 'TEX-HTML-TEX-PARSING::?CONT ESRAP-PEG::M))
; (TEX-HTML-TEX-PARSING::?NAME
; (IT.UNIMIB.DISCO.MA.CL.EXT.DACF.UNIFICATION:FIND-VARIABLE-VALUE
; 'TEX-HTML-TEX-PARSING::?NAME ESRAP-PEG::M))
; (TEX-HTML-TEX-PARSING::?OPTA
; (IT.UNIMIB.DISCO.MA.CL.EXT.DACF.UNIFICATION:FIND-VARIABLE-VALUE
; 'TEX-HTML-TEX-PARSING::?OPTA ESRAP-PEG::M))
; (TEX-HTML-TEX-PARSING::?STRICTA
; (IT.UNIMIB.DISCO.MA.CL.EXT.DACF.UNIFICATION:FIND-VARIABLE-VALUE
; 'TEX-HTML-TEX-PARSING::?STRICTA ESRAP-PEG::M)))
; (TEX-HTML-TEX-PARSING::S+ TEX-HTML-TEX-PARSING::?CONT))
;
; caught STYLE-WARNING:
; The variable ?NAME is defined but never used.
;
; caught STYLE-WARNING:
; The variable ?OPTA is defined but never used.
;
; caught STYLE-WARNING:
; The variable ?STRICTA is defined but never used.
;
; compilation unit finished
; caught 3 STYLE-WARNING conditions
#
TEX-HTML-TEX-PARSING> (funcall * (alexandria:read-file-into-string "~/Projects/Git/dpANS3/concept-arrays.tex"))
"$"
TEX-HTML-TEX-PARSING>