minor changes to many files
authorceriel <none@none>
Wed, 3 Jun 1987 19:05:14 +0000 (19:05 +0000)
committerceriel <none@none>
Wed, 3 Jun 1987 19:05:14 +0000 (19:05 +0000)
util/LLgen/src/LLgen.g
util/LLgen/src/gencode.c
util/LLgen/src/name.c
util/LLgen/src/reach.c
util/LLgen/src/tokens.g

index 9934d62..5ef6f6c 100644 (file)
@@ -149,7 +149,7 @@ rule                        {       register p_nont p;
                                p = &nonterms[g_getcont(temp)];
                                if (p->n_rule) {
                                        error(linecount,
-"nonterminal %s already defined", lextoken.t_string);
+"Nonterminal %s already defined", lextoken.t_string);
                                }
                                /*
                                 * Remember the order in which the nonterminals
@@ -360,10 +360,11 @@ simpleproduction(p_gram *p; register int *conflres;)
                                        if ((q->t_flags & PERSISTENT) &&
                                            kind == FIXED) {
                                                error(linecount,
-                                                       "illegal %%persistent");
+                                                       "Illegal %%persistent");
                                        }
                                        */
                                }
+                               termdeleted = 0;
                                *p_rule++ = elem;
                        }
          ]*            {       register p_term q;
@@ -530,7 +531,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
                        if (!level) unput(ch);
                        if (level || flag == 1) putc(ch,f);
                        if ((!level) && flag == 2 && !semicolon) {
-                               error(linecount,"missing ';'");
+                               error(linecount,"Missing ';'");
                        }
                        return;
                }
@@ -585,7 +586,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
                                        ch = input();
                                }
                                if (ch == '\n') {
-                                       error(linecount,"newline in string");
+                                       error(linecount,"Newline in string");
                                        unput(match);
                                }
                                putc(ch,f);
index 3e5f182..e67b284 100644 (file)
@@ -73,6 +73,15 @@ STATIC               genincrdecr();
 
 p_mem alloc();
 
+doclose(f)
+       FILE *f;
+{
+       if (ferror(f) != 0) {
+               fatal(0,"Write error on temporary");
+       }
+       fclose(f);
+}
+
 gencode(argc) {
        register p_file p = files;
        
@@ -90,10 +99,7 @@ gencode(argc) {
                copyfile(incl_file);
                generate(p);
                getaction(2);
-               if (ferror(fpars) != 0) {
-                       fatal(0,"Write error on temporary");
-               }
-               fclose(fpars);
+               doclose(fpars);
                /* And install */
                install(genname(p->f_name),p->f_name);
                p++;
@@ -124,10 +130,7 @@ geninclude() {
                                  p->t_tokno);
                }
        }
-       if (ferror(fpars) != 0) {
-               fatal(0,"write error on temporary");
-       }
-       fclose(fpars);
+       doclose(fpars);
        install(HFILE, ".");
 }
 
@@ -204,10 +207,7 @@ genrecovery() {
        }
        fputs("#define LL_NEWMESS\n", f);
        copyfile(rec_file);
-       if (ferror(f) != 0) {
-               fatal(0,"write error on temporary");
-       }
-       fclose(f);
+       doclose(f);
        install(RFILE, ".");
 }
 
index fa1ea08..f6cd38b 100644 (file)
@@ -130,16 +130,22 @@ search(type,str,option) register string str; {
                                if (type1 == LITERAL || type == LITERAL) {
                                        continue;
                                }
-                               if (type != UNKNOWN) {
+                               if (type == TERMINAL) {
                                        error(linecount,
-                                               "%s : illegal type",
+                                               "%s: is already a nonterminal",
+                                               str);
+                                       continue;
+                               }
+                               else if (type == NONTERM) {
+                                       error(linecount,
+                                               "%s : is already a token",
                                                str);
                                        continue;
                                }
                        }
                        if (option==ENTERING)  {
                                error(linecount,
-                                       "%s : already defined",str);
+                                       "%s : is already defined",str);
                        }
                        p->h_type.g_lineno = linecount;
                        return &(p->h_type);                    
index 46ff4cc..0604c2c 100644 (file)
@@ -46,7 +46,7 @@ co_reach() {
        for (p = nonterms; p < maxnt; p++) {
                if (! p->n_rule) {      /* undefined */
                        f_input = p->n_string;
-                       error(p->n_lineno,"nonterminal %s not defined",
+                       error(p->n_lineno,"Nonterminal %s not defined",
                                p->n_name);
                }
        }
@@ -66,7 +66,7 @@ co_reach() {
            for (s = x->f_list; s; s = s->o_next) {
                p = &nonterms[s->o_index];
                if (! (p->n_flags & REACHABLE)) {
-                       error(p->n_lineno,"nonterminal %s unreachable",
+                       warning(p->n_lineno,"nonterminal %s unreachable",
                                p->n_name);
                }
            }
index 026232a..425ce6c 100644 (file)
@@ -130,7 +130,7 @@ scanner() {
                        for (;;) {
                                ch = input();
                                if (ch == '\n' || ch == EOF) {
-                                       error(linecount,"missing '");
+                                       error(linecount,"Missing '");
                                        break;
                                }
                                if (ch == '\'') break;
@@ -190,7 +190,7 @@ scanner() {
                                        }
                                        w++;
                                }
-                               error(linecount,"illegal reserved word");
+                               error(linecount,"Illegal reserved word");
                        }
                        lextoken.t_string = ltext;
                        return C_IDENT;
@@ -245,7 +245,7 @@ skipcomment(flag) {
        int             saved;  /* line count on which comment starts */
 
        saved = linecount;
-       if (input() != '*') error(linecount,"illegal comment");
+       if (input() != '*') error(linecount,"Illegal comment");
        do {
                ch = input();
                while (ch == '*') {