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