From 71df09d022cd21a1764f6f50ab4f7c098c2c0d29 Mon Sep 17 00:00:00 2001 From: Manoel Trapier Date: Thu, 7 Mar 2013 19:06:12 +0100 Subject: [PATCH] Update tokens.g and regenerate tokens.c with it. --- util/LLgen/src/tokens.c | 23 +++++++++++------------ util/LLgen/src/tokens.g | 29 +++++++++++++++++------------ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/util/LLgen/src/tokens.c b/util/LLgen/src/tokens.c index 76cc43221..254bc7010 100644 --- a/util/LLgen/src/tokens.c +++ b/util/LLgen/src/tokens.c @@ -15,9 +15,6 @@ #define LL_assert(x) /* nothing */ #endif -#include -#include - extern int LLsymb; #define LL_SAFE(x) /* Nothing */ @@ -80,6 +77,9 @@ extern LLnc_recover(); # line 20 "tokens.g" +#include +#include + # include "types.h" # include "io.h" # include "extern.h" @@ -88,9 +88,8 @@ extern LLnc_recover(); #include "LLgen.h" -/* Here are defined : */ static int nparams; -# line 75 "tokens.g" +# line 63 "tokens.g" /* @@ -373,7 +372,7 @@ int input() { /* * Low level input routine, used by all other input routines */ - register c; + int c; if ((c = backupc)) { /* Last char was "unput()". Deliver it again @@ -400,14 +399,14 @@ int input() { return c; } -void unput(int c) { +void unput(c) { /* * "unread" c */ backupc = c; } -void skipcomment(int flag) { +void skipcomment(flag) { /* * Skip comment. If flag != 0, the comment is inside a fragment * of C-code, so keep it. @@ -448,7 +447,7 @@ STATIC void linedirective() { ch = input(); } while (ch != '\n' && c_class[ch] != ISDIG); if (ch == '\n') { - error(linecount, s_error, NULL, NULL); + error(linecount,s_error, NULL, NULL); return; } i = 0; @@ -463,7 +462,7 @@ STATIC void linedirective() { *c++ = ch = input(); } while (ch != '"' && ch != '\n'); if (ch == '\n') { - error(linecount, s_error, NULL, NULL); + error(linecount,s_error, NULL, NULL); return; } *--c = '\0'; @@ -479,7 +478,7 @@ STATIC void linedirective() { } # endif -STATIC string vallookup(int s) { +STATIC string vallookup(s) { /* * Look up the keyword that has token number s */ @@ -492,7 +491,7 @@ STATIC string vallookup(int s) { return 0; } -STATIC string cpy(int s, char *p, int inserted) { +STATIC string cpy(int s,string p, int inserted) { /* * Create a piece of error message for token s and put it at p. * inserted = 0 if the token s was deleted (in which case we have diff --git a/util/LLgen/src/tokens.g b/util/LLgen/src/tokens.g index 20fd0fcfc..0d940dd30 100644 --- a/util/LLgen/src/tokens.g +++ b/util/LLgen/src/tokens.g @@ -18,12 +18,17 @@ */ { +#include +#include + # include "types.h" # include "io.h" # include "extern.h" # include "assert.h" # include "cclass.h" +#include "LLgen.h" + static int nparams; } /* Classes */ @@ -138,7 +143,7 @@ STATIC void copyact(char ch1, char ch2, int flag, int level) { case ')': case '}': case ']': - error(linecount,"Parentheses mismatch"); + error(linecount,"Parentheses mismatch", NULL, NULL); break; case '(': text_seen = 1; @@ -169,7 +174,7 @@ STATIC void copyact(char ch1, char ch2, int flag, int level) { text_seen = 0; nparams++; if (ch == ',' && (flag & 2)) { - warning(linecount, "Parameters may not be separated with a ','"); + warning(linecount, "Parameters may not be separated with a ','", NULL, NULL); ch = ';'; } } @@ -190,7 +195,7 @@ STATIC void copyact(char ch1, char ch2, int flag, int level) { ch = input(); } if (ch == '\n') { - error(linecount,"Newline in string"); + error(linecount,"Newline in string", NULL, NULL); unput(match); } putc(ch,f); @@ -198,7 +203,7 @@ STATIC void copyact(char ch1, char ch2, int flag, int level) { if (ch == match) break; /* Fall through */ case EOF : - if (!level) error(saved,"Action does not terminate"); + if (!level) error(saved,"Action does not terminate", NULL, NULL); strip_grammar = sav_strip; return; default: @@ -258,7 +263,7 @@ int scanner() { for (;;) { ch = input(); if (ch == '\n' || ch == EOF) { - error(linecount,"Missing '"); + error(linecount,"Missing '", NULL, NULL); break; } if (ch == '\'') break; @@ -322,7 +327,7 @@ int scanner() { } w++; } - error(linecount,"Illegal reserved word"); + error(linecount,"Illegal reserved word", NULL, NULL); } lextoken.t_string = ltext; return C_IDENT; @@ -339,7 +344,7 @@ int input() { */ int c; - if (c = backupc) { + if ((c = backupc)) { /* Last char was "unput()". Deliver it again */ backupc = 0; @@ -380,7 +385,7 @@ void skipcomment(flag) { int saved; /* line count on which comment starts */ saved = linecount; - if (input() != '*') error(linecount,"Illegal comment"); + if (input() != '*') error(linecount,"Illegal comment", NULL, NULL); if (flag) putc('*', fact); do { ch = input(); @@ -391,7 +396,7 @@ void skipcomment(flag) { if (ch == '/') return; } } while (ch != EOF); - error(saved,"Comment does not terminate"); + error(saved,"Comment does not terminate", NULL, NULL); } # ifdef LINE_DIRECTIVE @@ -412,7 +417,7 @@ STATIC void linedirective() { ch = input(); } while (ch != '\n' && c_class[ch] != ISDIG); if (ch == '\n') { - error(linecount,s_error); + error(linecount,s_error, NULL, NULL); return; } i = 0; @@ -427,7 +432,7 @@ STATIC void linedirective() { *c++ = ch = input(); } while (ch != '"' && ch != '\n'); if (ch == '\n') { - error(linecount,s_error); + error(linecount,s_error, NULL, NULL); return; } *--c = '\0'; @@ -568,7 +573,7 @@ void LLmessage(int d) { #ifdef LLNONCORR else #endif - error(linecount, "%s", buf); + error(linecount, "%s", buf, NULL); /* Don't change this line to * error(linecount, buf). * The string in "buf" might contain '%' ... -- 2.34.1