Made acceptable for flex (no yylineno)

This commit is contained in:
ceriel 1991-01-11 14:32:43 +00:00
parent efa476b5b3
commit 818d2f10cf
4 changed files with 30 additions and 26 deletions

View file

@ -366,11 +366,11 @@ void rom(size, c) int size; long c;
void lin()
{
static oldline=0;
extern yylineno;
extern lineno;
if (Lflag) return;
if (yylineno!=oldline)
C_lin((arith) (oldline=yylineno));
if (lineno!=oldline)
C_lin((arith) (oldline=lineno));
}
static struct ftree {

View file

@ -22,6 +22,7 @@ int ind=0; /* Indentation level of current line */
static int tab=0; /* First indentation found */
int included=0; /* Is current file included? */
int lineno = 1;
%}
%%
@ -76,10 +77,13 @@ int included=0; /* Is current file included? */
return key;
}
\n[ \f\t]*/"--" {/* Line with only a comment, don't set tab */}
\n[ \f\t]*/"--" {/* Line with only a comment, don't set tab */
lineno++;
}
\n[ \f\t]* {
lineno++;
ind=indentation(yytext+1);
if (tab==0)
tab=ind;
@ -332,11 +336,11 @@ set_line_file(l) register char *l;
while (*l<'0' || *l>'9') l++;
yylineno=0;
lineno=0;
while ('0'<=*l && *l<='9')
yylineno=yylineno*10+(*l++ - '0');
lineno=lineno*10+(*l++ - '0');
yylineno--;
lineno--;
while (*l++!='"');

View file

@ -19,7 +19,7 @@ static void nonconst(), nonpositive(), rep_cleanup(), check_assoc();
void init_builtins();
char *strcpy();
extern int yylineno, LLsymb;
extern int lineno, LLsymb;
union type_info info, none;
}
%token AFTER, ALLOCATE, ALT, AND, ANY, BYTE, CHAN, DEF, FALSE, FOR, IF, LOAD;
@ -115,8 +115,8 @@ guarded_process(register *END;) { struct symbol *v;
guard(&F) process { branch(END);
Label(F);
}
| ALT { line=yylineno; oind=ind; }
[ %if (line==yylineno)
| ALT { line=lineno; oind=ind; }
[ %if (line==lineno)
replicator(&v, &e1, &e2)
{ rep_init(v, e1, e2, &to_test); }
guarded_process(END)
@ -144,8 +144,8 @@ conditional(register *END; ) { struct symbol *v;
{ branch(END);
Label(F);
}
| IF { line=yylineno; oind=ind; }
[ %if (line==yylineno)
| IF { line=lineno; oind=ind; }
[ %if (line==lineno)
replicator(&v, &e1, &e2)
{ rep_init(v, e1, e2, &to_test); }
conditional(END)
@ -176,8 +176,8 @@ construct { struct symbol *v;
register line, oind;
int BEGIN=0, END=0, NONZERO;
}:
SEQ { line=yylineno; oind=ind; }
[ %if (line==yylineno)
SEQ { line=lineno; oind=ind; }
[ %if (line==lineno)
replicator(&v, &e1, &e2)
{ rep_init(v, e1, e2, &to_test); }
process
@ -188,10 +188,10 @@ construct { struct symbol *v;
[ %while (tabulated(oind, ind)) process ]*
]
| PRI ?
[ PAR { line=yylineno; oind=ind;
[ PAR { line=lineno; oind=ind;
par_begin();
}
[ %if (line==yylineno)
[ %if (line==lineno)
replicator(&v, &e1, &e2)
{ rep_init(v, e1, e2, &to_test);
NONZERO=0;
@ -217,11 +217,11 @@ construct { struct symbol *v;
{ Label(END);
par_end();
}
| ALT { line=yylineno; oind=ind;
| ALT { line=lineno; oind=ind;
no_deadlock();
Label(new_label(&BEGIN));
}
[ %if (line==yylineno)
[ %if (line==lineno)
replicator(&v, &e1, &e2)
{ rep_init(v, e1, e2, &to_test); }
guarded_process(&END)
@ -237,8 +237,8 @@ construct { struct symbol *v;
Label(END);
}
]
| IF { line=yylineno; oind=ind; }
[ %if (line==yylineno)
| IF { line=lineno; oind=ind; }
[ %if (line==lineno)
replicator(&v, &e1, &e2)
{ rep_init(v, e1, e2, &to_test); }
conditional(&END)
@ -453,7 +453,7 @@ item(register struct expr **e;)
int byte, err=0, subs_call=0;
struct expr_list *elp=nil, **aelp= &elp;
}:
IDENTIFIER { line=yylineno;
IDENTIFIER { line=lineno;
oind=ind;
var=searchall(token.t_sval);
@ -465,7 +465,7 @@ item(register struct expr **e;)
*e=new_var(var);
}
}
[ %while (line==yylineno || tabulated(oind, ind))
[ %while (line==lineno || tabulated(oind, ind))
[ subscript(&byte, &e1)
{ *e=new_node('[', *e, e1, byte); }
| '(' { if (!var_declared(var)) {

View file

@ -5,13 +5,13 @@
*/
#include <system.h>
extern int err, yylineno;
extern int err, lineno;
extern char *curr_file;
/*VARARGS1*/
report(fmt, arg1, arg2, arg3) char *fmt;
{
fprint(STDERR, "%s (%d) F: ", curr_file, yylineno);
fprint(STDERR, "%s (%d) F: ", curr_file, lineno);
fprint(STDERR, fmt, arg1, arg2, arg3);
fprint(STDERR,"\n");
err=1;
@ -20,7 +20,7 @@ report(fmt, arg1, arg2, arg3) char *fmt;
/*VARARGS1*/
warning(fmt, arg1, arg2, arg3) char *fmt, *arg1;
{
fprint(STDERR, "%s (%d) E: ", curr_file, yylineno);
fprint(STDERR, "%s (%d) E: ", curr_file, lineno);
fprint(STDERR, fmt, arg1, arg2, arg3);
fprint(STDERR,"\n");
}
@ -28,7 +28,7 @@ warning(fmt, arg1, arg2, arg3) char *fmt, *arg1;
/*VARARGS1*/
fatal(fmt, arg1, arg2, arg3) char *fmt, *arg1;
{
fprint(STDERR, "%s (%d) X: ", curr_file, yylineno);
fprint(STDERR, "%s (%d) X: ", curr_file, lineno);
fprint(STDERR, fmt, arg1, arg2, arg3);
fprint(STDERR,"\n");
exit(1);