branch: externals/parser-generator commit 7cfdea21bf8514be4417af0980f3b0baa81efa98 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Passing tests for incremental lexer --- parser-generator-lr.el | 5 ++--- test/parser-generator-lr-test.el | 18 +++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/parser-generator-lr.el b/parser-generator-lr.el index 5046295..145c373 100644 --- a/parser-generator-lr.el +++ b/parser-generator-lr.el @@ -507,8 +507,7 @@ (nth 1 result))) ;; Algorithm 5.7, p. 375 -;; TODO Test incremental usage of this function -;; TODO Consider case with 2 character look-ahead +;; TODO Test cases with above 1 as look-ahead number (defun parser-generator-lr--parse (&optional input-tape-index pushdown-list @@ -537,7 +536,7 @@ (pre-index 0)) (while (not accept) - (message "output: %s, index: %s" output parser-generator-lex-analyzer--index) + ;; (message "output: %s, index: %s" output parser-generator-lex-analyzer--index) ;; Save history when index has changed (when diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el index 56eeae8..a520347 100644 --- a/test/parser-generator-lr-test.el +++ b/test/parser-generator-lr-test.el @@ -13,9 +13,9 @@ (defun parser-generator-lr-test--parse-incremental-vs-regular () "Verify that regular and incremental parse results in same data." (let ((regular-parse (parser-generator-lr--parse))) - (message "regular-parse: %s" regular-parse) + ;; (message "regular-parse: %s" regular-parse) (let ((regular-parse-history (nth 2 regular-parse))) - (message "regular-parse-history: %s" regular-parse-history) + ;; (message "regular-parse-history: %s" regular-parse-history) (let ((history-length (length regular-parse-history)) (history-index 0) (history) @@ -24,15 +24,15 @@ (setq history (nth history-index regular-parse-history)) (let ((input-tape-index (nth 0 history)) (pushdown-list (nth 1 history)) - (output (nreverse (nth 2 history))) + (output (nth 2 history)) (translation (nth 3 history)) (history-list iterated-history)) - (message "input-tape-index: %s" input-tape-index) - (message "pushdown-list: %s" pushdown-list) - (message "output: %s" output) - (message "translation: %s" translation) - (message "history-list: %s" history-list) + ;; (message "input-tape-index: %s" input-tape-index) + ;; (message "pushdown-list: %s" pushdown-list) + ;; (message "output: %s" output) + ;; (message "translation: %s" translation) + ;; (message "history-list: %s" history-list) (let ((incremental-parse (parser-generator-lr--parse @@ -41,7 +41,7 @@ output translation history-list))) - (message "incremental-parse: %s" incremental-parse) + ;; (message "incremental-parse: %s" incremental-parse) (should (equal regular-parse