Improved format of stack-effect strings.

This commit is contained in:
Paul Onions 2014-05-24 16:10:38 +01:00
parent 3b7843ea2b
commit 5a1eaf2c25
5 changed files with 5539 additions and 5526 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -38,7 +38,7 @@ As a side-effect set point to the start of the next line."
;;; Parsing identifier lines
;;;
(defun rpl-trim-stack-effect-description (lines)
(defun rpl-trim-stack-effect-lines (lines)
"Trim leading and trailing fluff from strings in LINES list."
(let ((left-edge 1000))
(dolist (s lines)
@ -51,6 +51,13 @@ As a side-effect set point to the start of the next line."
(substring s left-edge)))
lines)))
(defun rpl-tidy-stack-effect-lines (lines)
"Tidy-up stack-effect lines."
(rpl-trim-stack-effect-lines
(mapcar (lambda (ln)
(replace-regexp-in-string "\\\\->" "-->" ln))
lines)))
(defun rpl-edb-consume-ident-line ()
"Consume an EDB identifier line.
Return a list of two strings: the identifier and its stack effect
@ -65,7 +72,7 @@ description. Move point to the start of the next line."
(while (and (> (length (car desc)) 0)
(string-match ".*\\\\[[:blank:]]*$" (car desc)))
(setq desc (cons (rpl-edb-get-line) desc)))
(list name (rpl-trim-stack-effect-description (reverse desc)))))
(list name (rpl-tidy-stack-effect-lines (reverse desc)))))
(t
(list nil nil)))))
@ -140,7 +147,7 @@ Return a string. Move point to the start of the next line."
"A place on which to push the entries parsed from the EDB file.")
(defun rpl-edb-parse-buffer ()
"Parse the current buffer, assumed to be the entries.db file.
"Parse the current buffer, assumed to be the ``entries.db'' file.
Set `rpl-edb-entries' to the parsed results, a list of EDB
entries, where each entry has the format:
(NAMES STACK-EFFECT DESCRIPTION CALC-INFOS)
@ -240,13 +247,19 @@ calculator model, e.g. :48G, :49G etc."
(concat "sysrpl-data." (substring (symbol-name calculator) 1) ".el"))
(defun rpl-edb-make-calculator-data-file (calculator)
""
"Make the appropriate SysRPL data file for CALCULATOR.
The CALCULATOR is identified by keyword: :38G, :39G, :48G
or :49G."
(cl-assert (keywordp calculator))
(rpl-write-data-file (rpl-edb-generate-calculator-data calculator)
(rpl-edb-make-data-filename calculator)))
(defun rpl-edb-make-all-data-files ()
""
"Create all SysRPL data files.
Assumes the current buffer contains the ``entries.db'' file
created by Carsten Dominik, parsing it if necessary to set the
`rpl-edb-entries' variable, then writing captured data to the
SysRPL data files, one for each calculator type."
(interactive)
(unless rpl-edb-entries
(rpl-edb-parse-buffer))