[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/parser-generator 9d5df0e 375/434: More working on tryin
From: |
ELPA Syncer |
Subject: |
[elpa] externals/parser-generator 9d5df0e 375/434: More working on trying to get the Infix example working |
Date: |
Mon, 29 Nov 2021 16:00:19 -0500 (EST) |
branch: externals/parser-generator
commit 9d5df0e08eb9dc44338ced454a2000dba27ab803
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
More working on trying to get the Infix example working
---
parser-generator-lr.el | 4 ---
test/parser-generator-lr-test.el | 74 ++++++++++++++++++++++++++--------------
2 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index 52d4c57..859189d 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -1039,8 +1039,6 @@
symbol
parser-generator-lr--global-precedence-table))
(b-precedence-value))
- (message "parser-generator-lr--reduce-takes-precedence-p: %S %S %S" symbol
a-production-number b-production-number)
- (message "a-precedence-value: %S from %S" a-precedence-value
parser-generator-lr--global-precedence-table)
;; Context-sensitive precedence takes precedence over
;; global precedence
@@ -1077,8 +1075,6 @@
b-precedence-symbol
parser-generator-lr--global-precedence-table)))))))
- ;; TODO Need to pass action type of A and B to comparison function
-
(funcall
parser-generator-lr--precedence-comparison-function
a-precedence-value
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index d10240c..7dbaafa 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -856,35 +856,59 @@
(lambda(a b)
(cond
((and a b)
- (let ((a-op (car a))
- (a-value (car (cdr a)))
- (b-op (car b))
- (b-value (car (cdr b))))
+ (let ((a-left (plist-get a '%left))
+ (a-precedence (plist-get a '%precedence))
+ (a-right (plist-get a '%right))
+ (b-left (plist-get b '%left))
+ (b-precedence (plist-get b '%precedence))
+ (b-right (plist-get b '%right)))
+ (message "a-left: %S a-precedence: %S a-right: %S" a-left
a-precedence a-right)
(cond
- ((>= a-value b-value)
+ (a-left
(cond
- ((eq a-op '%left)
- t)
- ((eq a-op '%right)
- nil)
- ((eq a-op '%precedence)
- t)))
- ((> b-value a-value)
+ ((and
+ b-left
+ (> a-left b-left)
+ t)
+ nil)))
+ (a-right
(cond
- ((eq b-op '%left)
- nil)
- ((eq b-op '%right)
- t)
- ((eq b-op '%precedence)
- nil))))))
+ ((and
+ a-right
+ (> a-right b-right))
+ nil
+ (t
+ t))))
+ (a-precedence
+ ((cond
+ ((and
+ a-precedence
+ (> a-precedence b-precedence))
+ t)
+ (t
+ nil)))))))
(a
- (cond
- ((eq (car a) '%left)
- t)
- ((eq (car a) '%right)
- nil)
- ((eq (car a) '%precedence)
- t)))
+ (let ((a-left (plist-get a '%left))
+ (a-precedence (plist-get a '%precedence))
+ (a-right (plist-get a '%right)))
+ (cond
+ ((or
+ a-left
+ a-precedence)
+ t)
+ (t
+ nil))))
+ (b
+ (let ((b-left (plist-get b '%left))
+ (b-precedence (plist-get b '%precedence))
+ (b-right (plist-get b '%right)))
+ (cond
+ ((or
+ b-left
+ b-precedence)
+ nil)
+ (t
+ t))))
(t
nil))))
(setq
- [elpa] externals/parser-generator 778b96f 335/434: More work on global precedence declaration, (continued)
- [elpa] externals/parser-generator 778b96f 335/434: More work on global precedence declaration, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 0523eeb 336/434: More work on global precedence, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 0aed7b0 339/434: More work on global precedence in LR(k) parser, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator b84ed5e 342/434: Fixed issue with infix calculator translation test, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator f449039 346/434: More debugging, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 34f95b3 351/434: More debugging infix calculator, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator bb82646 356/434: More debugging, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator b040d9b 357/434: Tests for infix calculator working, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 4404424 367/434: Added test for parsing context-sensitive attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 2ad866c 371/434: Context-sensitive attribute are now tested through specified comparison function, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 9d5df0e 375/434: More working on trying to get the Infix example working,
ELPA Syncer <=
- [elpa] externals/parser-generator 8fb8676 376/434: More work on Infix math example, passing another test, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 32e2c15 024/434: Fixed bug with e-production, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 26bf153 037/434: Setting look-ahead-number is now separated from setting grammar, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator a54061c 055/434: Debugging of new algorithm, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 62d06a0 063/434: Passing unit test for V(Sa), ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 186d7bb 065/434: Renamed function lr-items to lr-items-for-prefix, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 9792eeb 069/434: Added TODO items, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 08b40cd 071/434: Updated header levels in README, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 5da1b28 079/434: Added TODO item, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 79565f4 089/434: Fixed sorting of columns in GOTO-table, ELPA Syncer, 2021/11/29