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

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

[elpa] externals/parser-generator 783ea61 227/434: Added translation-sym


From: ELPA Syncer
Subject: [elpa] externals/parser-generator 783ea61 227/434: Added translation-symbol-table to incremental parser and translater
Date: Mon, 29 Nov 2021 15:59:46 -0500 (EST)

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

    Added translation-symbol-table to incremental parser and translater
---
 parser-generator-lr.el           | 9 +++++++--
 test/parser-generator-lr-test.el | 4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index fd336ed..d914d3a 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -654,12 +654,15 @@
                pushdown-list
                output
                translation
+               translation-symbol-table
                history)
   "Perform a LR-parse via lex-analyzer, optionally at INPUT-TAPE-INDEX with 
PUSHDOWN-LIST, OUTPUT, TRANSLATION and HISTORY."
   (unless input-tape-index
     (setq input-tape-index 1))
   (unless pushdown-list
     (push 0 pushdown-list))
+  (unless translation-symbol-table
+    (setq translation-symbol-table (make-hash-table :test 'equal)))
 
   (if (and
        input-tape-index
@@ -677,7 +680,6 @@
 
   (let ((accept)
         (pre-index 0)
-        (translation-symbol-table (make-hash-table :test 'equal))
         (e-list
          (parser-generator--generate-list-of-symbol
           parser-generator--look-ahead-number
@@ -698,7 +700,8 @@
          `(,parser-generator-lex-analyzer--index
            ,pushdown-list
            ,output
-           ,translation)
+           ,translation
+           ,translation-symbol-table)
          history)
         (setq
          pre-index
@@ -708,6 +711,7 @@
       (let ((look-ahead
              (parser-generator-lex-analyzer--peek-next-look-ahead))
             (look-ahead-full))
+
         ;; Save token stream indexes in separate variable if needed later
         (setq look-ahead-full (nreverse look-ahead))
 
@@ -972,6 +976,7 @@
     (list
      output
      translation
+     translation-symbol-table
      history)))
 
 (provide 'parser-generator-lr)
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index 56bc835..ae9935f 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -14,7 +14,7 @@
   "Verify that regular and incremental parse results in same data."
   (let ((regular-parse (parser-generator-lr--parse)))
     ;; (message "regular-parse: %s" regular-parse)
-    (let ((regular-parse-history (nth 2 regular-parse)))
+    (let ((regular-parse-history (nth 3 regular-parse)))
       ;; (message "regular-parse-history: %s" regular-parse-history)
       (let ((history-length (length regular-parse-history))
             (history-index 0)
@@ -26,6 +26,7 @@
                 (pushdown-list (nth 1 history))
                 (output (nth 2 history))
                 (translation (nth 3 history))
+                (translation-symbol-table (nth 4 history))
                 (history-list iterated-history))
 
             ;; (message "input-tape-index: %s" input-tape-index)
@@ -40,6 +41,7 @@
                     pushdown-list
                     output
                     translation
+                    translation-symbol-table
                     history-list)))
               ;; (message "incremental-parse: %s" incremental-parse)
               (should



reply via email to

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