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

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

[elpa] externals/parser-generator 3a178ed 393/434: Exported LR parser no


From: ELPA Syncer
Subject: [elpa] externals/parser-generator 3a178ed 393/434: Exported LR parser now passes all tests
Date: Mon, 29 Nov 2021 16:00:23 -0500 (EST)

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

    Exported LR parser now passes all tests
---
 parser-generator-lr-export.el           | 57 ++++-----------------------------
 parser-generator-lr.el                  |  7 ++--
 test/parser-generator-lr-export-test.el |  9 +++---
 3 files changed, 14 insertions(+), 59 deletions(-)

diff --git a/parser-generator-lr-export.el b/parser-generator-lr-export.el
index 2862221..e295322 100644
--- a/parser-generator-lr-export.el
+++ b/parser-generator-lr-export.el
@@ -520,8 +520,6 @@
                namespace
                namespace
                namespace
-               namespace
-               namespace
                namespace))
 
       (insert "
@@ -574,12 +572,14 @@
                   ;; (c) If f(u) = error, we halt parsing (and, in practice
                   ;; transfer to an error recovery routine)."
                namespace))
+
       (insert "
                   (error
                    (format
                     \"Invalid syntax! Expected one of %s found %s at %s\"
                     possible-look-aheads
                     look-ahead")
+
       (insert (format "
                     %s-lex-analyzer--index)
                    possible-look-aheads
@@ -702,8 +702,6 @@
                namespace
                namespace
                namespace
-               namespace
-               namespace
                namespace))
 
       (insert "
@@ -716,29 +714,9 @@
 ")
 
       (insert (format "
-                                  ;; If we have a translation for symbol, pop 
one
-                                  ;; otherwise push nil on translation 
argument stack
+                              ;; If we have a translation for symbol, pop one
+                              ;; otherwise push nil on translation argument 
stack
                               (if (gethash
-                                   temp-hash-key
-                                   translation-symbol-table)
-                                  (let ((symbol-translations
-                                         (gethash
-                                          temp-hash-key
-                                          translation-symbol-table)))
-                                    (push
-                                     partial-translation
-                                     symbol-translations)
-                                    (puthash
-                                     temp-hash-key
-                                     symbol-translations
-                                     translation-symbol-table)
-                                    (setq
-                                     translation
-                                     partial-translation))))))
-
-                          ;; If we have a translation for symbol, pop one
-                                  ;; otherwise push nil on translation 
argument stack
-                                  (if (gethash
                                        temp-hash-key
                                        translation-symbol-table)
                                       (let ((symbol-translations
@@ -772,13 +750,7 @@
                                        (funcall
                                         
(parser-generator--get-grammar-translation-by-number
                                          production-number)
-                                        popped-items-meta-contents)))"
-                      namespace
-                      namespace
-                      namespace
-                      namespace
-                      namespace
-                      namespace))
+                                        popped-items-meta-contents)))"))
 
       (insert "
                                   (let ((temp-hash-key
@@ -804,14 +776,7 @@
 
                               ;; When no translation is specified just use 
popped contents as translation
                               (let ((partial-translation
-                                     popped-items-meta-contents))"
-                                          namespace
-                                          namespace
-                                          namespace
-                                          namespace
-                                          namespace
-                                          namespace
-                                          namespace))
+                                     popped-items-meta-contents))"))
                (insert "
                                 (let ((temp-hash-key
                                        (format
@@ -903,13 +868,6 @@
                namespace
                namespace
                namespace
-               namespace
-               namespace
-               namespace
-               namespace
-               namespace
-               namespace
-               namespace
                ))
 
       ;; Parse
@@ -932,8 +890,6 @@
           history)))
     (nth 0 result)))\n"
                namespace
-               namespace
-               namespace
                namespace))
 
       ;; Translate
@@ -963,6 +919,7 @@
        (format
         "\n(provide '%s)"
         namespace))
+
       (insert
        (format
         "\n\n;;; %s.el ends here"
diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index 00f0161..713d055 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -1011,7 +1011,6 @@
         (a)
         (a-look-ahead)
         (a-follow)
-        (a-follow-full)
         (a-index 0)
         (a-production)
         (a-production-number)
@@ -1157,10 +1156,9 @@
                           (when
                               signal-on-false
                             (error
-                             "Inconsistent grammar! '%S' (index: %d) with 
look-ahead '%S' conflicts with '%S' (index: %d) with look-ahead '%S' in 
sets:\n%S"
+                             "Inconsistent grammar! '%S' (index: %d) conflicts 
with '%S' (index: %d) with look-ahead '%S' in sets:\n%S"
                              a
                              a-index
-                             a-follow-full
                              b
                              b-index
                              b-suffix-follow-eff-item
@@ -1169,10 +1167,9 @@
                     (when
                         signal-on-false
                       (error
-                       "Inconsistent grammar! '%S' (index: %d) with look-ahead 
'%S' conflicts with '%S' (index: %d) with look-ahead '%S' in sets:\n%S"
+                       "Inconsistent grammar! '%S' (index: %d) conflicts with 
'%S' (index: %d) with look-ahead '%S' in sets:\n%S"
                        a
                        a-index
-                       a-follow-full
                        b
                        b-index
                        b-suffix-follow-eff-item
diff --git a/test/parser-generator-lr-export-test.el 
b/test/parser-generator-lr-export-test.el
index b9a7558..c2f0b68 100644
--- a/test/parser-generator-lr-export-test.el
+++ b/test/parser-generator-lr-export-test.el
@@ -62,7 +62,7 @@
     ;; Export parser
     (let ((export (parser-generator-lr-export-to-elisp "ba")))
       (parser-generator--debug
-       (message "export:\n%s\n" export))
+       (message "export:\n%S\n" export))
       (with-temp-buffer
         (insert export)
         (eval-buffer)
@@ -177,8 +177,8 @@
 
   ;; Export parser
   (let ((export (parser-generator-lr-export-to-elisp "e")))
-
-    (message "export:\n%S\n" export)
+    (parser-generator--debug
+     (message "export:\n%S\n" export))
 
     (with-temp-buffer
       (insert export)
@@ -232,7 +232,8 @@
     ;; Export parser
     (let ((export (parser-generator-lr-export-to-elisp "fa")))
       (with-temp-buffer
-        (message "Export:\n%S" export)
+        (parser-generator--debug
+         (message "export:\n%S\n" export))
         (insert export)
         (eval-buffer)
         (should



reply via email to

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