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

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

[elpa] externals/parser-generator 32e2c15 024/434: Fixed bug with e-prod


From: ELPA Syncer
Subject: [elpa] externals/parser-generator 32e2c15 024/434: Fixed bug with e-production
Date: Mon, 29 Nov 2021 15:59:01 -0500 (EST)

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

    Fixed bug with e-production
---
 parser.el           | 13 +++++++------
 test/parser-test.el |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/parser.el b/parser.el
index be01ce3..34b3ae7 100644
--- a/parser.el
+++ b/parser.el
@@ -383,16 +383,17 @@
                                   ;; Should branch off here, each unique 
permutation should be included in set
                                   ;; Follow first alternative in this scope 
but follow the rest in separate scopes
                                   (let ((sub-terminal-index 0))
-                                    (dolist (sub-terminal-set 
sub-terminal-sets)
+                                    (dolist (sub-terminal-alternative-set 
sub-terminal-sets)
                                       (unless (= sub-terminal-index 0)
+                                        (parser--debug (message 
"Sub-terminal-alternative-set: %s" sub-terminal-alternative-set))
 
                                         ;; When we have a leading terminal and 
sub-terminal set is empty, don't append it
                                         (when (and
-                                               (> leading-terminals-count 0)
-                                               (parser--valid-e-p 
sub-terminal-set))
-                                          (setq sub-terminal-set nil))
+                                               (< input-tape-index (1- 
input-tape-length))
+                                               (parser--valid-e-p (car 
sub-terminal-alternative-set)))
+                                          (setq sub-terminal-alternative-set 
nil))
 
-                                        (let ((sub-rhs-leading-terminals 
(append leading-terminals sub-terminal-set)))
+                                        (let ((sub-rhs-leading-terminals 
(append leading-terminals sub-terminal-alternative-set)))
                                           (when (> (length 
sub-rhs-leading-terminals) k)
                                             (setq sub-rhs-leading-terminals 
(butlast sub-rhs-leading-terminals (- (length sub-rhs-leading-terminals) k))))
                                           (push `(,sub-rhs-leading-terminals 
,all-leading-terminals-p ,(1+ input-tape-index)) stack)))
@@ -400,7 +401,7 @@
 
                                 (parser--debug (message "Sub-terminal-set: %s" 
sub-terminal-set))
                                 (when (or
-                                       (not (parser--valid-e-p 
sub-terminal-set))
+                                       (not (parser--valid-e-p (car 
sub-terminal-set)))
                                        (= input-tape-index (1- 
input-tape-length)))
                                   (setq leading-terminals (append 
leading-terminals sub-terminal-set))
                                   (setq leading-terminals-count (+ 
leading-terminals-count (length sub-terminal-set)))
diff --git a/test/parser-test.el b/test/parser-test.el
index 2004fa3..2d82ea1 100644
--- a/test/parser-test.el
+++ b/test/parser-test.el
@@ -94,7 +94,7 @@
   (parser--set-grammar '((S A B C) (a b c) ((S A B) (A (B a) e) (B (C b) C) (C 
c e)) S) 1)
   (should
    (equal
-    '((a) (b) (c) (e))
+    '((e) (c) (b) (a))
     (parser--first 'S)))
   (message "Passed first 1 with complex grammar")
 



reply via email to

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