branch: externals/parser-generator
commit 186d7bb47c58f6128d99ac6164faa1f53039067b
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Renamed function lr-items to lr-items-for-prefix
---
README.md | 6 +++---
parser.el | 2 +-
test/parser-test.el | 16 ++++++++--------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 8d1196f..7e3ef9b 100644
--- a/README.md
+++ b/README.md
@@ -139,7 +139,7 @@ Calculate the look-ahead number of terminals possibly
following S.
(parser--follow 'A)))
```
-### LR(k) items - V(S)
+### LR(k) items for prefix - V(S)
Calculate the set of LR(k) items valid for any viable prefix S.
@@ -154,7 +154,7 @@ Calculate the set of LR(k) items valid for any viable
prefix S.
(S nil nil (e))
(S nil (S a S b) (e))
(Sp nil (S) (e)))
- (parser--lr-items 'e)))
+ (parser--lr-items-for-prefix 'e)))
```
``` emacs-lisp
@@ -166,7 +166,7 @@ Calculate the set of LR(k) items valid for any viable
prefix S.
'((Sp (S) nil (e))
(S (S) (a S b) (e))
(S (S) (a S b) (a)))
- (parser--lr-items 'S)))
+ (parser--lr-items-for-prefix 'S)))
```
## Test
diff --git a/parser.el b/parser.el
index 9e9004d..6a0ef52 100644
--- a/parser.el
+++ b/parser.el
@@ -636,7 +636,7 @@
follow-set))
;; Algorithm 5.8, p. 386
-(defun parser--lr-items (γ)
+(defun parser--lr-items-for-prefix (γ)
"Calculate valid LR-items for the viable prefix Γ."
(let ((lr-items (make-hash-table :test 'equal))
(start (parser--get-grammar-start)))
diff --git a/test/parser-test.el b/test/parser-test.el
index 5972483..4404665 100644
--- a/test/parser-test.el
+++ b/test/parser-test.el
@@ -223,9 +223,9 @@
(message "Passed tests for (parser--empty-free-first)"))
-(defun parser-test--lr-items ()
- "Test `parser--lr-items'."
- (message "Starting tests for (parser--lr-items)")
+(defun parser-test--lr-items-for-prefix ()
+ "Test `parser--lr-items-for-prefix'."
+ (message "Starting tests for (parser--lr-items-for-prefix)")
;; Example 5.29 p 387
(parser--set-grammar '((Sp S) (a b) ((Sp S) (S (S a S b)) (S e)) Sp))
@@ -238,7 +238,7 @@
(S nil nil (e))
(S nil (S a S b) (e))
(Sp nil (S) (e)))
- (parser--lr-items 'e)))
+ (parser--lr-items-for-prefix 'e)))
(message "Passed V(e)")
(should
@@ -246,7 +246,7 @@
'((Sp (S) nil (e))
(S (S) (a S b) (e))
(S (S) (a S b) (a)))
- (parser--lr-items 'S)))
+ (parser--lr-items-for-prefix 'S)))
(message "Passed V(S)")
(should
@@ -257,10 +257,10 @@
(S nil (S a S b) (b))
(S (S a) (S b) (a))
(S (S a) (S b) (e)))
- (parser--lr-items '(S a))))
+ (parser--lr-items-for-prefix '(S a))))
(message "Passed V(Sa)")
- (message "Passed tests for (parser--lr-items)"))
+ (message "Passed tests for (parser--lr-items-for-prefix)"))
(defun parser-test--valid-grammar-p ()
"Test function `parser--valid-grammar-p'."
@@ -397,7 +397,7 @@
(parser-test--first)
(parser-test--e-free-first)
(parser-test--follow)
- (parser-test--lr-items))
+ (parser-test--lr-items-for-prefix))
(provide 'parser-test)