shithub: rgbds

Download patch

ref: caddd61f178307b746ee6cb4ed47834ddca68dc3
parent: 29629245a4f764aae6f6f7559c72f943d688e4f5
author: ISSOtm <eldredhabert0@gmail.com>
date: Thu Mar 26 18:36:40 EDT 2020

Remove "column 1" restriction for local labels

Because a local symbol is necessarily a label, the disambiguation
is not necessary. This is a first step towards fixing #457.

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -555,7 +555,6 @@
 %left	NEG /* negation -- unary minus */
 
 %token	<tzSym> T_LABEL
-%token	<tzSym> T_LOCAL_LABEL
 %type	<tzSym> scoped_label
 %type	<tzSym> scoped_label_bare
 %token	<tzSym> T_ID
@@ -671,12 +670,12 @@
 scoped_label_bare : T_LABEL {
 			warning(WARNING_OBSOLETE, "Non-local labels without a colon are deprecated");
 		}
-		| T_LOCAL_LABEL
+		| T_LOCAL_ID
 ;
 scoped_label	: T_LABEL ':' {
 			strcpy($$, $1);
 		}
-		| T_LOCAL_LABEL ':' {
+		| T_LOCAL_ID ':' {
 			strcpy($$, $1);
 		}
 ;
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -905,12 +905,8 @@
 		if (type == T_ID && strchr(yylval.tzSym, '.'))
 			type = T_LOCAL_ID;
 
-		if (linestart) {
-			if (type == T_ID)
-				return T_LABEL;
-			if (type == T_LOCAL_ID)
-				return T_LOCAL_LABEL;
-		}
+		if (linestart && type == T_ID)
+			return T_LABEL;
 		return type;
 	}