branch: externals/parser-generator commit 0f8b422edfbfd6122873f366a6a9a097d0657278 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added another unit test for follow function --- parser.el | 2 +- test/parser-test.el | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/parser.el b/parser.el index 2d2dfa0..7b06b8b 100644 --- a/parser.el +++ b/parser.el @@ -534,7 +534,7 @@ (let ((symbol (nth input-tape-index input-tape))) (cond ((parser--valid-terminal-p symbol) - (push symbol first) + (setq first (append first (list symbol))) (setq first-length (1+ first-length))) ((parser--valid-non-terminal-p symbol) (parser--debug diff --git a/test/parser-test.el b/test/parser-test.el index 1817fcd..24de34b 100644 --- a/test/parser-test.el +++ b/test/parser-test.el @@ -70,6 +70,14 @@ (parser--follow 'A))) (message "Passed follow 2 with intermediate grammar") + (parser--set-grammar '((S A B) (a c d f) ((S (A a)) (A (B c d)) (B (c f) d)) S)) + (parser--set-look-ahead-number 2) + (should + (equal + '((c d)) + (parser--follow 'B))) + (message "Passed follow 3 with intermediate grammar") + (message "Passed tests for (parser--follow)")) (defun parser-test--first ()