shithub: rgbds

Download patch

ref: c2787a9ea9dcc6558775aaf17669b921e642f1ff
parent: e33e6e24132dea1490e3039a6c85194d2b6a7a74
author: dbrotz <[email protected]>
date: Tue Aug 20 04:50:18 EDT 2019

Change the precedence of == to match the documentation
The documentation states that == has the same precedence as the other
comparison operators.

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -537,8 +537,8 @@
 %token	<tzString>	T_STRING
 
 %left	<nConstValue>	T_OP_LOGICNOT
-%left	<nConstValue>	T_OP_LOGICOR T_OP_LOGICAND T_OP_LOGICEQU
-%left	<nConstValue>	T_OP_LOGICGT T_OP_LOGICLT T_OP_LOGICGE T_OP_LOGICLE T_OP_LOGICNE
+%left	<nConstValue>	T_OP_LOGICOR T_OP_LOGICAND
+%left	<nConstValue>	T_OP_LOGICGT T_OP_LOGICLT T_OP_LOGICGE T_OP_LOGICLE T_OP_LOGICNE T_OP_LOGICEQU
 %left	<nConstValue>	T_OP_ADD T_OP_SUB
 %left	<nConstValue>	T_OP_OR T_OP_XOR T_OP_AND
 %left	<nConstValue>	T_OP_SHL T_OP_SHR
--- /dev/null
+++ b/test/asm/operator-precedence.asm
@@ -1,0 +1,7 @@
+print: MACRO
+	printv \1
+	printt "\n"
+ENDM
+
+	print 1 == 1 || 1 == 2
+	print (1 == 1) || (1 == 2)
--- /dev/null
+++ b/test/asm/operator-precedence.out
@@ -1,0 +1,2 @@
+$1
+$1
--- /dev/null
+++ b/test/asm/operator-precedence.out.pipe
@@ -1,0 +1,2 @@
+$1
+$1