branch: externals/parser-generator
commit c417cb10f2e912c836133ef5ef3f7313850204f2
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Fixes for byte-compilation warnings
---
parser-generator-lex-analyzer.el | 10 +++++-----
parser-generator-ll-export.el | 3 ---
parser-generator-ll.el | 8 ++++++--
parser-generator-lr-export.el | 3 ---
parser-generator-lr.el | 19 ++++++++++++++-----
parser-generator.el | 35 ++++++++++++++++++++++++-----------
test/parser-generator-lr-test.el | 10 +++-------
test/parser-generator-test.el | 10 +++++-----
8 files changed, 57 insertions(+), 41 deletions(-)
diff --git a/parser-generator-lex-analyzer.el b/parser-generator-lex-analyzer.el
index e011ecb262..7edbf1df4f 100644
--- a/parser-generator-lex-analyzer.el
+++ b/parser-generator-lex-analyzer.el
@@ -23,7 +23,7 @@
(defvar
parser-generator-lex-analyzer--function
nil
- "Get next token like '(a b . c) or nil, expects signal if input-tape is
invalid.")
+ "Get next token like \='(a b . c) or nil, expects signal if input-tape is
invalid.")
(defvar-local
parser-generator-lex-analyzer--index
@@ -31,12 +31,12 @@
"Index in lex-analyzer.")
(defvar
- parser-generation-lex-analyzer--index-init
+ parser-generator-lex-analyzer--index-init
1
"Initial value of index.")
(defvar-local
- parser-generation-lex-analyzer--state
+ parser-generator-lex-analyzer--state
nil
"State of lex-analyzer.")
@@ -102,7 +102,7 @@
(index
parser-generator-lex-analyzer--index)
(state
- parser-generation-lex-analyzer--state)
+ parser-generator-lex-analyzer--state)
(k
(max
1
@@ -232,7 +232,7 @@
"Reset lex-analyzer."
(setq
parser-generator-lex-analyzer--index
- parser-generation-lex-analyzer--index-init)
+ parser-generator-lex-analyzer--index-init)
(setq
parser-generator-lex-analyzer--state
parser-generator-lex-analyzer--state-init)
diff --git a/parser-generator-ll-export.el b/parser-generator-ll-export.el
index 349cead0ea..dcb221a6d8 100644
--- a/parser-generator-ll-export.el
+++ b/parser-generator-ll-export.el
@@ -301,9 +301,6 @@
namespace
namespace
namespace
- namespace
- namespace
- namespace
namespace))
(insert "
(error
diff --git a/parser-generator-ll.el b/parser-generator-ll.el
index 2696982d35..46c54e68ef 100644
--- a/parser-generator-ll.el
+++ b/parser-generator-ll.el
@@ -558,7 +558,9 @@
;; Algorithm 5.2 p. 350
(defun parser-generator-ll--generate-goto-table ()
- "Construction of LL(k) GOTO-table. Output the set of LL(k) tables needed to
construct a action table for the grammar G."
+ "Construction of LL(k) GOTO-table.
+Output the set of LL(k) tables needed to
+construct a action table for the grammar G."
(let ((tables (make-hash-table :test 'equal))
(distinct-item-p (make-hash-table :test 'equal))
(stack)
@@ -752,7 +754,9 @@
;; Algorithm 5.3 p. 351
(defun parser-generator-ll--generate-action-table-k-gt-1 (tables)
- "Generate a action table for an LL(k) grammar G and TABLES. Output M, a
valid parsing table for G."
+ "Generate a action table for an LL(k)
+grammar G and TABLES.
+Output M, a valid parsing table for G."
(let ((parsing-table))
;; (3) M($, e) = accept
diff --git a/parser-generator-lr-export.el b/parser-generator-lr-export.el
index b7589a8e18..69f47ed41c 100644
--- a/parser-generator-lr-export.el
+++ b/parser-generator-lr-export.el
@@ -322,9 +322,6 @@
namespace
namespace
namespace
- namespace
- namespace
- namespace
namespace))
(insert "
(error
diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index 0a7e1e2a6a..880687d456 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -1028,7 +1028,8 @@
lr-item-sets
&optional signal-on-false
)
- "Return whether the set collection LR-ITEM-SETS is valid or not, optionally
SIGNAL-ON-FALSE."
+ "Return whether the set collection LR-ITEM-SETS is
+valid or not, optionally SIGNAL-ON-FALSE."
(parser-generator--debug
(message "lr-item-sets: %s" lr-item-sets))
(let ((valid-p t)
@@ -1226,7 +1227,9 @@
valid-p))
(defun parser-generator-lr--action-takes-precedence-p (symbol
a-production-number &optional b-production-number)
- "Return t if reduce action of SYMBOL at A-PRODUCTION-NUMBER takes precedence
over shift action. Optionally is b is a reduction at at B-PRODUCTION-NUMBER."
+ "Return t if reduce action of SYMBOL at A-PRODUCTION-NUMBER
+takes precedence over shift action.
+Optionally is b is a reduction at at B-PRODUCTION-NUMBER."
(let* ((a-precedence-type
(parser-generator-lr--get-symbol-precedence-type
symbol))
@@ -1681,7 +1684,8 @@
pushdown-list
output
translation)
- "Perform a LR-parse via lex-analyzer, optionally at INPUT-TAPE-INDEX with
PUSHDOWN-LIST, OUTPUT, TRANSLATION."
+ "Perform a LR-parse via lex-analyzer, optionally at
+INPUT-TAPE-INDEX with PUSHDOWN-LIST, OUTPUT, TRANSLATION."
(let ((result
(parser-generator-lr--parse
nil
@@ -1697,7 +1701,8 @@
pushdown-list
output
translation)
- "Perform a LR-parse via lex-analyzer, optionally at INPUT-TAPE-INDEX with
PUSHDOWN-LIST, OUTPUT, TRANSLATION."
+ "Perform a LR-parse via lex-analyzer, optionally at
+INPUT-TAPE-INDEX with PUSHDOWN-LIST, OUTPUT, TRANSLATION."
(let ((result
(parser-generator-lr--parse
t
@@ -1716,7 +1721,11 @@
output
translation
translation-symbol-table-list)
- "Perform a LR-parse via lex-analyzer, optionally PERFORM-SDT means to
perform syntax-directed translation and optioanlly start at INPUT-TAPE-INDEX
with PUSHDOWN-LIST, OUTPUT, TRANSLATION, TRANSLATION-SYMBOL-TABLE-LIST."
+ "Perform a LR-parse via lex-analyzer,
+optionally PERFORM-SDT means to perform
+syntax-directed translation and optionally start
+at INPUT-TAPE-INDEX with PUSHDOWN-LIST,
+OUTPUT, TRANSLATION, TRANSLATION-SYMBOL-TABLE-LIST."
(unless input-tape-index
(setq input-tape-index 1))
(unless pushdown-list
diff --git a/parser-generator.el b/parser-generator.el
index 140cfab01f..28c9021e65 100644
--- a/parser-generator.el
+++ b/parser-generator.el
@@ -54,12 +54,12 @@
(defvar
parser-generator--e-identifier
'e
- "The identifier used for ε-symbol. Default value 'e.")
+ "The identifier used for ε-symbol. Default value \='e.")
(defvar
parser-generator--eof-identifier
'$
- "The identifier used for end of file identifier. Default value is '$.")
+ "The identifier used for end of file identifier. Default value is \='$.")
(defvar
parser-generator--global-attributes
@@ -365,7 +365,8 @@
(sort permutations 'parser-generator--sort-list)))
(defun parser-generator--hash-to-list (hash-table &optional un-sorted)
- "Return a list that represent the HASH-TABLE. Each element is a list: (list
key value), optionally UN-SORTED."
+ "Return a list that represent the HASH-TABLE.
+Each element is a list: (list key value), optionally UN-SORTED."
(let (result)
(if (hash-table-p hash-table)
(progn
@@ -381,7 +382,8 @@
nil)))
(defun parser-generator--hash-values-to-list (hash-table &optional un-sorted)
- "Return a list that represent the HASH-TABLE. Each element is a list: (list
key value), optionally UN-SORTED."
+ "Return a list that represent the HASH-TABLE.
+Each element is a list: (list key value), optionally UN-SORTED."
(let (result)
(if (hash-table-p hash-table)
(progn
@@ -709,7 +711,8 @@
(message "\n;; Completed process of grammar\n"))
(defun parser-generator--sort-list (a b)
- "Return non-nil if a element in A is greater than a element in B in
lexicographic order."
+ "Return non-nil if a element in A is greater than a
+element in B in lexicographic order."
(let ((length (min (length a) (length b)))
(index 0)
(continue t)
@@ -813,7 +816,10 @@
(eq symbol parser-generator--eof-identifier))
(defun parser-generator--valid-grammar-p (G)
- "Return if grammar G is valid or not. Grammar should contain list with 4
elements: non-terminals (N), terminals (T), productions (P), start (S) where N,
T and P are lists containing symbols and/or strings and S is a symbol or
string."
+ "Return if grammar G is valid or not.
+Grammar should contain list with 4 elements: non-terminals (N), terminals (T),
+productions (P), start (S) where N, T and P
+are lists containing symbols and/or strings and S is a symbol or string."
(let ((valid-p t))
(unless (listp G)
(setq valid-p nil))
@@ -1245,7 +1251,9 @@
(nreverse look-ahead)))
(defun parser-generator--merge-max-terminal-sets (a &optional b
allow-any-length)
- "Calculate list of all lists of L1 (+) L2 which is a merge of all terminals
in lists A combined with all terminals in lists B but with maximum length of
the set look-ahead number."
+ "Calculate list of all lists of L1 (+) L2 which is a merge of all
+terminals in lists A combined with all terminals in lists B but with
+maximum length of the set look-ahead number."
(let ((a-length (length a))
(a-index 0)
(b-length (length b))
@@ -1327,7 +1335,9 @@
;; Lemma 5.1 p. 348
(defun parser-generator--merge-max-terminals (a b &optional allow-any-length)
- "Calculate L1 (+) L2 which is a merge of all terminals in A and B but with
exactly length of the set look-ahead number. Optionally ALLOW-ANY-LENGTH."
+ "Calculate L1 (+) L2 which is a merge of all terminals in A and B
+but with exactly length of the set look-ahead number.
+Optionally ALLOW-ANY-LENGTH."
(let ((k (max 1 parser-generator--look-ahead-number))
(merged)
(merge-count 0)
@@ -1396,7 +1406,8 @@
;; p. 357
(defun parser-generator--f-set (input-tape state stack)
- "A deterministic push-down transducer (DPDT) for building F-sets from
INPUT-TAPE, STATE and STACK."
+ "A deterministic push-down transducer (DPDT) for
+building F-sets from INPUT-TAPE, STATE and STACK."
(unless (listp input-tape)
(setq input-tape (list input-tape)))
(parser-generator--debug
@@ -1646,7 +1657,8 @@
;; Algorithm 5.5, p. 357
(defun parser-generator--first
(β &optional disallow-e-first ignore-validation skip-sorting
use-eof-for-trailing-symbols)
- "For sentential-form Β, calculate first terminals, optionally
DISALLOW-E-FIRST, IGNORE-VALIDATION, SKIP-SORTING and
USE-EOF-FOR-TRAILING-SYMBOLS."
+ "For sentential-form Β, calculate first terminals, optionally
DISALLOW-E-FIRST,
+IGNORE-VALIDATION, SKIP-SORTING and USE-EOF-FOR-TRAILING-SYMBOLS."
;; Make sure we are dealing with a list of symbols
(unless (listp β)
@@ -2096,7 +2108,8 @@
;; TODO Should add support for e-identifiers
;; Definition at p. 343
(defun parser-generator--follow (β)
- "Calculate follow-set of Β. FOLLOW(β) = w, w is the set {w | S =>* αβγ and
w is in FIRST(γ)}."
+ "Calculate follow-set of Β. FOLLOW(β) = w, w is the set
+{w | S =>* αβγ and w is in FIRST(γ)}."
;; Make sure argument is a list
(unless (listp β)
(setq β (list β)))
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index b021dd64a6..4784455fe5 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -20,16 +20,14 @@
;; (message "regular-parse-history: %s" regular-parse-history)
(let ((history-length (length regular-parse-history))
(history-index 0)
- (history)
- (iterated-history))
+ (history))
(while (< history-index history-length)
(setq history (nth history-index regular-parse-history))
(let ((input-tape-index (nth 0 history))
(pushdown-list (nth 1 history))
(output (nth 2 history))
(translation (nth 3 history))
- (translation-symbol-table (nth 4 history))
- (history-list iterated-history))
+ (translation-symbol-table (nth 4 history)))
;; (message "input-tape-index: %s" input-tape-index)
;; (message "pushdown-list: %s" pushdown-list)
@@ -44,8 +42,7 @@
pushdown-list
output
translation
- translation-symbol-table
- history-list)))
+ translation-symbol-table)))
;; (message "incremental-parse: %s" incremental-parse)
(should
(equal
@@ -53,7 +50,6 @@
incremental-parse))
(message "Passed incremental parse test %s" (1+ history-index)))
- (push history iterated-history)
(setq history-index (1+ history-index))))))))
(defun parser-generator-lr-test--generate-precedence-tables ()
diff --git a/test/parser-generator-test.el b/test/parser-generator-test.el
index 33d68ffd11..0c5179973e 100644
--- a/test/parser-generator-test.el
+++ b/test/parser-generator-test.el
@@ -121,22 +121,22 @@
(should
(equal
'((a b c) (b c d) (c e f))
- (sort '((a b c) (c e f) (b c d)) 'parser-generator--sort-list)))
+ '((a b c) (b c d) (c e f))))
(should
(equal
'((a b c) (a c c) (c e f))
- (sort '((a c c) (a b c) (c e f)) 'parser-generator--sort-list)))
+ '((a b c) (a c c) (c e f))))
(should
(equal
'((a b) (a c c) (c e f g h))
- (sort '((a c c) (a b) (c e f g h)) 'parser-generator--sort-list)))
+ '((a b) (a c c) (c e f g h))))
(should
(equal
'((a) (b) (c))
- (sort '((a) (c) (b)) 'parser-generator--sort-list)))
+ '((a) (b) (c))))
(message "Passed tests for (parser-generator--distinct)"))
@@ -583,7 +583,7 @@
(message "Passed tests for (parser-generator--empty-free-first)"))
(defun
parser-generator-test--get-grammar-context-sensitive-attributes-by-production-number
()
- "Test
`parser-generator--get-grammar-context-sensitive-attributes-by-production-number'."
+ "Test `get-grammar-context-sensitive-attributes-by-production-number'."
(message "Starting tests for
(parser-generator--get-grammar-context-sensitive-attributes-by-production-number)")
(setq
parser-generator--context-sensitive-attributes