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.
This commit is contained in:
ISSOtm
2020-03-26 22:36:40 +01:00
parent 29629245a4
commit caddd61f17
2 changed files with 4 additions and 9 deletions

View File

@@ -555,7 +555,6 @@ static void strsubUTF8(char *dest, const char *src, uint32_t pos, uint32_t len)
%left NEG /* negation -- unary minus */ %left NEG /* negation -- unary minus */
%token <tzSym> T_LABEL %token <tzSym> T_LABEL
%token <tzSym> T_LOCAL_LABEL
%type <tzSym> scoped_label %type <tzSym> scoped_label
%type <tzSym> scoped_label_bare %type <tzSym> scoped_label_bare
%token <tzSym> T_ID %token <tzSym> T_ID
@@ -671,12 +670,12 @@ line : label
scoped_label_bare : T_LABEL { scoped_label_bare : T_LABEL {
warning(WARNING_OBSOLETE, "Non-local labels without a colon are deprecated"); warning(WARNING_OBSOLETE, "Non-local labels without a colon are deprecated");
} }
| T_LOCAL_LABEL | T_LOCAL_ID
; ;
scoped_label : T_LABEL ':' { scoped_label : T_LABEL ':' {
strcpy($$, $1); strcpy($$, $1);
} }
| T_LOCAL_LABEL ':' { | T_LOCAL_ID ':' {
strcpy($$, $1); strcpy($$, $1);
} }
; ;

View File

@@ -905,12 +905,8 @@ scanagain:
if (type == T_ID && strchr(yylval.tzSym, '.')) if (type == T_ID && strchr(yylval.tzSym, '.'))
type = T_LOCAL_ID; type = T_LOCAL_ID;
if (linestart) { if (linestart && type == T_ID)
if (type == T_ID) return T_LABEL;
return T_LABEL;
if (type == T_LOCAL_ID)
return T_LOCAL_LABEL;
}
return type; return type;
} }