branch: externals/parser-generator
commit 40473d3df88378f2d64fec08b66d79308d5b5432
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Fixed bug with data in full look-ahead in parse function
---
parser-generator-lr.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index 5e0183c..498623a 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -905,7 +905,7 @@
(look-ahead-full))
;; Save token stream indexes in separate variable if needed later
- (setq look-ahead-full (nreverse look-ahead))
+ (setq look-ahead-full look-ahead)
;; Create simplified look-ahead for logic below
(setq look-ahead nil)
@@ -913,9 +913,11 @@
(if (listp look-ahead-item)
(push (car look-ahead-item) look-ahead)
(push look-ahead-item look-ahead)))
+ (setq look-ahead (nreverse look-ahead))
(parser-generator--debug
- (message "look-ahead: %s" look-ahead))
+ (message "look-ahead: %s" look-ahead)
+ (message "look-ahead-full: %s" look-ahead-full))
(let ((table-index
(car pushdown-list)))
@@ -941,9 +943,14 @@
(< action-index action-table-length))
(let ((action (nth action-index action-table)))
(let ((action-look-ahead (car action)))
- (push action-look-ahead possible-look-aheads)
- (when (equal action-look-ahead look-ahead)
- (setq action-match (cdr action)))))
+ (push
+ action-look-ahead
+ possible-look-aheads)
+ (when (equal
+ action-look-ahead
+ look-ahead)
+ (setq action-match
+ (cdr action)))))
(setq action-index (1+ action-index)))
(unless action-match