[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/parser-generator 21948c8 358/434: Fixed lex-analyzer to
From: |
ELPA Syncer |
Subject: |
[elpa] externals/parser-generator 21948c8 358/434: Fixed lex-analyzer to infix calculator test to support white-space and floats |
Date: |
Mon, 29 Nov 2021 16:00:15 -0500 (EST) |
branch: externals/parser-generator
commit 21948c8baac9566b41c04631e0e1edb60cab5da2
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Fixed lex-analyzer to infix calculator test to support white-space and
floats
---
test/parser-generator-lr-test.el | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index 013e3c1..cfb4c41 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -540,8 +540,15 @@
(point-max))
(goto-char
index)
+
+ ;; Skip white-space(s)
+ (when (looking-at-p "[\t ]+")
+ (when
+ (search-forward-regexp "[^\t ]" nil t)
+ (forward-char -1)))
+
(cond
- ((looking-at "[0-9]+")
+ ((looking-at "\\([0-9]+\\.[0-9]+\\|[0-9]+\\)")
(setq
token
`(NUM ,(match-beginning 0) . ,(match-end 0))))
@@ -565,7 +572,7 @@
(let ((symbol
(buffer-substring-no-properties start end)))
(when
- (string-match-p "^[0-9]+$" symbol)
+ (string-match-p "^\\([0-9]+\\.[0-9]+\\|[0-9]+\\)$" symbol)
(setq
symbol
(string-to-number symbol)))
@@ -574,7 +581,6 @@
(parser-generator-process-grammar)
(parser-generator-lr-generate-parser-tables)
- ;; TODO Test functionality here (then move to translate test)
(let ((buffer (generate-new-buffer "*buffer*")))
(switch-to-buffer buffer)
(kill-region (point-min) (point-max))
@@ -621,7 +627,6 @@
(parser-generator-lr-translate)))
(message "Passed 10/5")
-
(switch-to-buffer buffer)
(kill-region (point-min) (point-max))
(insert "8+10/5\n")
@@ -845,6 +850,15 @@
(parser-generator-lr-translate)))
(message "Passed -33-3 with correct result")
+ (switch-to-buffer buffer)
+ (kill-region (point-min) (point-max))
+ (insert "4 + 4.5 - (34/(8*3+-3))")
+ (should
+ (equal
+ 6.880952381
+ (parser-generator-lr-translate)))
+ (message "Passed 4 + 4.5 - (34/(8*3+-3)) with correct result")
+
(kill-buffer))
(message "Passed tests for (parser-generator-lr--parse)"))
- [elpa] externals/parser-generator 236a124 322/434: More work on resolving conflicts, (continued)
- [elpa] externals/parser-generator 236a124 322/434: More work on resolving conflicts, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 04c360b 318/434: LR-items set validation now supports symbols with attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator ea02245 325/434: Improved debug output, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e56bcff 324/434: Improved output of productions and action-tables, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator fb29641 337/434: Passing old context-sensitive precedence example with new structure, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 928b31d 343/434: More work on infix calculator, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 6a4b353 344/434: More work on translations, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 85d1b49 345/434: Infix calculator translation passing some tests, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 08e9876 347/434: Fixed bug with associating a translation to multiple productions, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator c6d3ad2 352/434: Infix calculator working as expected without precedence rules, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 21948c8 358/434: Fixed lex-analyzer to infix calculator test to support white-space and floats,
ELPA Syncer <=
- [elpa] externals/parser-generator 14711d4 363/434: Added more debug stuff, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator f0f2daa 364/434: Started refactor of context-sensitive attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 7e1d2fb 368/434: Added TODO notes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 5a1f09a 369/434: More work on adding support for production number related precedence, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e4658d9 372/434: LR action-table generation is now using context-sensitive precedence resolution for reduce/reduce conflicts, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 6aff9d0 373/434: Made TODO notes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 831a6e6 379/434: Made a commentary audit of parse according to GOTO and ACTION tables, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator bff0e63 380/434: Added TODO note, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 97b5e59 381/434: Comparing precedence of last symbol of production with look-ahead, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 5ff13d2 382/434: Improvements in test for precedence, ELPA Syncer, 2021/11/29