emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/parser-generator 47fb35e 229/434: More work on a more g


From: ELPA Syncer
Subject: [elpa] externals/parser-generator 47fb35e 229/434: More work on a more generalized LR Parser
Date: Mon, 29 Nov 2021 15:59:47 -0500 (EST)

branch: externals/parser-generator
commit 47fb35eb4727f62dc0845bf3dcd0f6ddf22eb869
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    More work on a more generalized LR Parser
---
 parser-generator-lr.el           | 13 +++++++------
 test/parser-generator-lr-test.el | 36 ++++++++++++++++++------------------
 2 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index 4048b33..369b4eb 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -261,7 +261,7 @@
                       (parser-generator--debug
                        (message "Set already exists in: %s" goto))
                       (push
-                       `(,(car symbol) ,goto)
+                       `(,symbol ,goto)
                        goto-table-table))
 
                   (parser-generator--debug
@@ -272,7 +272,7 @@
 
                   ;; then add a' to S as an unmarked set of items
                   (push
-                   `(,(car symbol) ,lr-item-set-new-index)
+                   `(,symbol ,lr-item-set-new-index)
                    goto-table-table)
                   (push
                    `(,lr-item-set-new-index ,prefix-lr-items)
@@ -821,8 +821,8 @@
                 ;; there is no next input symbol or g(a) is undefined, halt
                 ;; and declare error.
 
-                (let ((a (list (car look-ahead)))
-                      (a-full (list (car look-ahead-full))))
+                (let ((a look-ahead)
+                      (a-full look-ahead-full))
                   (let ((goto-table
                          (gethash
                           table-index
@@ -837,7 +837,7 @@
                               searching-match
                               (< goto-index goto-table-length))
                         (let ((goto-item (nth goto-index goto-table)))
-                          (let ((goto-item-symbol (list (car goto-item)))
+                          (let ((goto-item-symbol (car goto-item))
                                 (goto-item-next-index (car (cdr goto-item))))
                             (push goto-item-symbol possible-look-aheads)
 
@@ -850,6 +850,7 @@
                               (setq searching-match nil))))
 
                         (setq goto-index (1+ goto-index)))
+
                       (parser-generator--debug
                        (message "next-index: %s" next-index))
 
@@ -972,7 +973,7 @@
                                     searching-match
                                     (< goto-index goto-table-length))
                               (let ((goto-item (nth goto-index goto-table)))
-                                (let ((goto-item-symbol (list (car goto-item)))
+                                (let ((goto-item-symbol (car goto-item))
                                       (goto-item-next-index (car (cdr 
goto-item))))
                                   (parser-generator--debug
                                    (message "goto-item: %s" goto-item)
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index f54d4d0..79b537a 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -65,13 +65,13 @@
 
     (should
      (equal
-      '((0 ((S 1)))
-        (1 ((a 2)))
-        (2 ((S 3)))
-        (3 ((a 4) (b 5)))
-        (4 ((S 6)))
+      '((0 (((S) 1)))
+        (1 (((a) 2)))
+        (2 (((S) 3)))
+        (3 (((a) 4) ((b) 5)))
+        (4 (((S) 6)))
         (5 nil)
-        (6 ((a 4) (b 7)))
+        (6 (((a) 4) ((b) 7)))
         (7 nil))
       (parser-generator--hash-to-list
        parser-generator-lr--goto-tables)))
@@ -140,13 +140,13 @@
 
     (should
      (equal
-      '((0 ((S 1)))
-        (1 ((a 2)))
-        (2 ((S 3)))
-        (3 ((a 4) (b 5)))
-        (4 ((S 6)))
+      '((0 (((S) 1)))
+        (1 (((a) 2)))
+        (2 (((S) 3)))
+        (3 (((a) 4) ((b) 5)))
+        (4 (((S) 6)))
         (5 nil)
-        (6 ((a 4) (b 7)))
+        (6 (((a) 4) ((b) 7)))
         (7 nil))
       (parser-generator--hash-to-list
        parser-generator-lr--goto-tables)))
@@ -182,13 +182,13 @@
 
     (should
      (equal
-      '((0 ((S 1)))
-        (1 (("a" 2)))
-        (2 ((S 3)))
-        (3 (("a" 4) ("b" 5)))
-        (4 ((S 6)))
+      '((0 (((S) 1)))
+        (1 ((("a") 2)))
+        (2 (((S) 3)))
+        (3 ((("a") 4) (("b") 5)))
+        (4 (((S) 6)))
         (5 nil)
-        (6 (("a" 4) ("b" 7)))
+        (6 ((("a") 4) (("b") 7)))
         (7 nil))
       (parser-generator--hash-to-list parser-generator-lr--goto-tables)))
     (message "Passed GOTO-tables with tokens as strings")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]