Made acceptable for flex (no yylineno)
authorceriel <none@none>
Fri, 11 Jan 1991 14:32:43 +0000 (14:32 +0000)
committerceriel <none@none>
Fri, 11 Jan 1991 14:32:43 +0000 (14:32 +0000)
lang/occam/comp/em.c
lang/occam/comp/lex.l
lang/occam/comp/occam.g
lang/occam/comp/report.c

index 8bb635b..47df184 100644 (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 {
index fdc19e8..ae6d6bd 100644 (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++!='"');
 
index e78cc46..49bc124 100644 (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)) {
index 7cc8f9f..76252bd 100644 (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);