shithub: pico

Download patch

ref: 90c1e6b8bad7302018388c4e9c1d30fd975ad134
parent: 0d63c6d2a5b5bc61213fd2e7ccf6779a7c789780
author: qwx <[email protected]>
date: Wed Jan 8 22:28:06 EST 2020

fix lexing issue with coordinates and XYZ constants

--- a/pico.y
+++ b/pico.y
@@ -198,6 +198,13 @@
 			*p++ = r;
 	*p = 0;
 	inp -= n;
+	if(runestrcmp(s, L"x") == 0
+	|| runestrcmp(s, L"X") == 0
+	|| runestrcmp(s, L"y") == 0
+	|| runestrcmp(s, L"Y") == 0
+	|| runestrcmp(s, L"z") == 0
+	|| runestrcmp(s, L"Z") == 0)
+		return s[0];
 	yylval.s = sym("%S", s);
 	if(runestrcmp(s, L"new") == 0)
 		return NEW;
@@ -269,13 +276,7 @@
 	case ']':
 	case ',':
 	case '(':
-	case ')':
-	case 'x':
-	case 'X':
-	case 'y':
-	case 'Y':
-	case 'z':
-	case 'Z': return r;
+	case ')': return r;
 	case '&': return follow(r, '&', AND);
 	case '|': return follow(r, '|', OR);
 	case '*': return follow(r, '*', POW);