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

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

[elpa] externals/parser-generator c1cdf20 197/434: Fixed issue with lex


From: ELPA Syncer
Subject: [elpa] externals/parser-generator c1cdf20 197/434: Fixed issue with lex analyzer reached end of input
Date: Mon, 29 Nov 2021 15:59:40 -0500 (EST)

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

    Fixed issue with lex analyzer reached end of input
---
 parser-generator-lex-analyzer.el           | 20 +++++++++++---------
 test/parser-generator-lex-analyzer-test.el |  2 +-
 test/parser-generator-lr-test.el           |  5 ++---
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/parser-generator-lex-analyzer.el b/parser-generator-lex-analyzer.el
index e2aa7e4..be98fbe 100644
--- a/parser-generator-lex-analyzer.el
+++ b/parser-generator-lex-analyzer.el
@@ -40,9 +40,10 @@
   (let ((meta-information))
     (condition-case error
         (progn
-          (setq meta-information (funcall
-                                  parser-generator-lex-analyzer--get-function
-                                  token)))
+          (setq meta-information
+                (funcall
+                 parser-generator-lex-analyzer--get-function
+                 token)))
       (error (error
               "Lex-analyze failed to get token meta-data of %s, error: %s"
               token
@@ -108,12 +109,13 @@
                    (funcall
                     parser-generator-lex-analyzer--function
                     parser-generator-lex-analyzer--index)))
-              (unless (listp (car token))
-                (setq token (list token)))
-              (let ((first-token (car token)))
-                (setq parser-generator-lex-analyzer--index
-                      (cdr (cdr first-token)))
-                (push first-token tokens))))
+              (when token
+                (unless (listp (car token))
+                  (setq token (list token)))
+                (let ((first-token (car token)))
+                  (setq parser-generator-lex-analyzer--index
+                        (cdr (cdr first-token)))
+                  (push first-token tokens)))))
         (error (error
                 "Lex-analyze failed to pop token at %s, error: %s"
                 parser-generator-lex-analyzer--index
diff --git a/test/parser-generator-lex-analyzer-test.el 
b/test/parser-generator-lex-analyzer-test.el
index 5cee3f0..e86f8f8 100644
--- a/test/parser-generator-lex-analyzer-test.el
+++ b/test/parser-generator-lex-analyzer-test.el
@@ -125,7 +125,7 @@
     (parser-generator-lex-analyzer--pop-token)))
   (should
    (equal
-    '(nil)
+    nil
     (parser-generator-lex-analyzer--pop-token)))
 
   (message "Ended tests for (parser-generator-lex-analyzer--pop-token)"))
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index 554f801..75c5fef 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -363,7 +363,6 @@
        (nreverse tokens))))
 
   (parser-generator-lr-test--parse-incremental-vs-regular)
-
   (message "Passed incremental-tests")
 
   ;; (parser-generator-set-grammar '((Sp S) ("a" "b") ((Sp S) (S (S "a" S 
"b")) (S e)) Sp))
@@ -374,7 +373,7 @@
   ;; (setq
   ;;  parser-generator-lex-analyzer--function
   ;;  (lambda (index)
-  ;;    (let* ((string '(("a" 1 . 2) ("a" 2 . 3) ("b" 3 . 4) ("b" 4 . 5)))
+  ;;    (let* ((string '(("a" 1 . 2) ("a" 2 . 3) ("b" 3 . 4)))
   ;;           (string-length (length string))
   ;;           (max-index index)
   ;;           (tokens))
@@ -552,7 +551,7 @@
 
 (defun parser-generator-lr-test ()
   "Run test."
-  ;; (setq debug-on-error t)
+  (setq debug-on-error t)
 
   (parser-generator-lr-test--items-for-prefix)
   (parser-generator-lr-test--items-valid-p)



reply via email to

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