Imported Upstream version 5.12.0.220

Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-04-24 09:31:23 +00:00
parent 8bd104cef2
commit 8fc30896db
1200 changed files with 29534 additions and 26161 deletions

View File

@@ -58,7 +58,75 @@ static int lowzero;
static int high;
extern int csharp;
output () {
static void
free_itemsets (void);
static void
free_reductions (void);
static void
free_shifts (void);
static void
goto_actions (void);
static void
output_actions (void);
static void
output_base (void);
static void
output_check (void);
static void
output_debug (void);
static void
output_defines (const char *prefix);
static void
output_rule_data (void);
static void
output_semantic_actions (void);
static void
output_stored_text (FILE *file, const char *name);
static void
output_table (void);
static void
output_trailing_text (void);
static void
save_column (int symbol, int default_state);
static void
sort_actions (void);
static void
output_yydefred (void);
static int
default_goto (int symbol);
static int
matching_vector (int vector);
static int
pack_vector (int vector);
static void
token_actions (void);
static void
pack_table (void);
void
output (void)
{
int lno = 0;
char buf [128];
@@ -77,7 +145,7 @@ output () {
case '.': break;
default:
cp = strtok(buf, " \t\r\n");
if (cp)
if (cp) {
if (strcmp(cp, "actions") == 0) output_semantic_actions();
else if (strcmp(cp, "debug") == 0) output_debug();
else if (strcmp(cp, "epilog") == 0) output_trailing_text();
@@ -91,6 +159,7 @@ output () {
output_defines(strtok(NULL, "\r\n"));
else
fprintf(stderr, "jay: unknown call (%s) in line %d\n", cp, lno);
}
continue;
}
fputs(buf+1, stdout), ++ outline;
@@ -98,7 +167,8 @@ output () {
free_parser();
}
output_rule_data()
static void
output_rule_data (void)
{
register int i;
register int j;
@@ -160,8 +230,8 @@ output_rule_data()
printf("\n };\n");
}
output_yydefred()
static void
output_yydefred (void)
{
register int i, j;
@@ -189,8 +259,8 @@ output_yydefred()
printf("\n };\n");
}
output_actions()
static void
output_actions (void)
{
nvectors = 2*nstates + nvars;
@@ -217,8 +287,8 @@ output_actions()
output_check();
}
token_actions()
static void
token_actions (void)
{
register int i, j;
register int shiftcount, reducecount;
@@ -302,7 +372,8 @@ token_actions()
FREE(actionrow);
}
goto_actions()
static void
goto_actions (void)
{
register int i, j, k;
@@ -334,9 +405,8 @@ goto_actions()
FREE(state_count);
}
int
default_goto(symbol)
int symbol;
static int
default_goto (int symbol)
{
register int i;
register int m;
@@ -369,11 +439,8 @@ int symbol;
return (default_state);
}
save_column(symbol, default_state)
int symbol;
int default_state;
static void
save_column (int symbol, int default_state)
{
register int i;
register int m;
@@ -413,7 +480,8 @@ int default_state;
width[symno] = sp1[-1] - sp[0] + 1;
}
sort_actions()
static void
sort_actions (void)
{
register int i;
register int j;
@@ -447,8 +515,8 @@ sort_actions()
}
}
pack_table()
static void
pack_table (void)
{
register int i;
register int place;
@@ -510,9 +578,8 @@ pack_table()
/* faster. Also, it depends on the vectors being in a specific */
/* order. */
int
matching_vector(vector)
int vector;
static int
matching_vector (int vector)
{
register int i;
register int j;
@@ -549,11 +616,8 @@ int vector;
return (-1);
}
int
pack_vector(vector)
int vector;
static int
pack_vector (int vector)
{
register int i, j, k, l;
register int t;
@@ -627,9 +691,8 @@ int vector;
}
}
output_base()
static void
output_base (void)
{
register int i, j;
@@ -695,9 +758,8 @@ output_base()
FREE(base);
}
output_table()
static void
output_table (void)
{
register int i;
register int j;
@@ -724,9 +786,8 @@ output_table()
FREE(table);
}
output_check()
static void
output_check (void)
{
register int i;
register int j;
@@ -755,12 +816,10 @@ output_check()
FREE(check);
}
int
is_C_identifier(name)
char *name;
static int
is_C_identifier (const char *name)
{
register char *s;
const char *s;
register int c;
s = name;
@@ -780,7 +839,7 @@ char *name;
if (!isalpha(c) && c != '_' && c != '$')
return (0);
while (c = *++s)
while ((c = *++s))
{
if (!isalnum(c) && c != '_' && c != '$')
return (0);
@@ -788,12 +847,11 @@ char *name;
return (1);
}
output_defines(prefix)
char *prefix;
static void
output_defines (const char *prefix)
{
register int c, i;
register char *s;
const char *s;
for (i = 2; i < ntokens; ++i)
{
@@ -816,7 +874,7 @@ char *prefix;
{
putchar(c);
}
while (c = *++s);
while ((c = *++s));
}
++outline;
printf(" = %d%s\n", symbol_value[i], csharp ? ";" : ";");
@@ -827,10 +885,8 @@ char *prefix;
printf(" %s yyErrorCode = %d%s\n", prefix ? prefix : "", symbol_value[1], csharp ? ";" : ";");
}
output_stored_text(file, name)
FILE *file;
char *name;
static void
output_stored_text (FILE *file, const char *name)
{
register int c;
register FILE *in;
@@ -854,12 +910,12 @@ char *name;
fclose(in);
}
output_debug()
static void
output_debug (void)
{
register int i, j, k, max;
char **symnam, *s;
char * prefix = tflag ? "" : "//t";
const char * prefix = tflag ? "" : "//t";
++outline;
printf(" protected %s int yyFinal = %d;\n", csharp ? "const" : "static final", final_state);
@@ -941,12 +997,12 @@ output_debug()
symnam[i] = 0;
for (i = ntokens - 1; i >= 2; --i)
symnam[symbol_value[i]] = symbol_name[i];
symnam[0] = "end-of-file";
symnam[0] = (char*)"end-of-file";
j = 70; fputs(" ", stdout);
for (i = 0; i <= max; ++i)
{
if (s = symnam[i])
if ((s = symnam[i]))
{
if (s[0] == '"')
{
@@ -1068,7 +1124,8 @@ output_debug()
FREE(symnam);
}
output_trailing_text()
static void
output_trailing_text (void)
{
register int c, last;
register FILE *in;
@@ -1116,8 +1173,8 @@ output_trailing_text()
printf(default_line_format, ++outline + 1);
}
output_semantic_actions()
static void
output_semantic_actions (void)
{
register int c, last;
@@ -1150,8 +1207,8 @@ output_semantic_actions()
printf(default_line_format, ++outline + 1);
}
free_itemsets()
static void
free_itemsets (void)
{
register core *cp, *next;
@@ -1163,8 +1220,8 @@ free_itemsets()
}
}
free_shifts()
static void
free_shifts (void)
{
register shifts *sp, *next;
@@ -1176,9 +1233,8 @@ free_shifts()
}
}
free_reductions()
static void
free_reductions (void)
{
register reductions *rp, *next;