yasm_errwarns *errwarns)
{
yasm_parser_gas parser_gas;
+ int i;
parser_gas.object = object;
parser_gas.linemap = linemap;
parser_gas.rept = NULL;
+ for (i=0; i<10; i++)
+ parser_gas.local[i] = 0;
+
/* yacc debugging, needs YYDEBUG set in bison.y.in to work */
parser_gas.debug = 1;
char peek_tokch;
/*@null@*/ gas_rept *rept;
+
+ /* Index of local labels; what's stored here is the /next/ index,
+ * so these are all 0 at start.
+ */
+ unsigned long local[10];
} yasm_parser_gas;
/* shorter access names to commonly used parser_gas fields */
RETURN(LABEL);
}
+ /* local label */
+ [0-9] ':' {
+ /* increment label index */
+ parser_gas->local[s->tok[0]-'0']++;
+ /* build local label name */
+ lvalp->str_val = yasm_xmalloc(30);
+ sprintf(lvalp->str_val, "L%c\001%lu", s->tok[0],
+ parser_gas->local[s->tok[0]-'0']);
+ RETURN(LABEL);
+ }
+
+ /* local label forward reference */
+ [0-9] 'f' {
+ /* build local label name */
+ lvalp->str_val = yasm_xmalloc(30);
+ sprintf(lvalp->str_val, "L%c\001%lu", s->tok[0],
+ parser_gas->local[s->tok[0]-'0']+1);
+ RETURN(ID);
+ }
+
+ /* local label backward reference */
+ [0-9] 'b' {
+ /* build local label name */
+ lvalp->str_val = yasm_xmalloc(30);
+ sprintf(lvalp->str_val, "L%c\001%lu", s->tok[0],
+ parser_gas->local[s->tok[0]-'0']);
+ RETURN(ID);
+ }
+
/* identifier that may be an instruction, etc. */
[a-zA-Z][a-zA-Z0-9_$.]* {
/* Can only be an instruction/prefix when not inside an