# Checking GLR Parsing: Regression Tests -*- Autotest -*-
-# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#include <stdarg.h>
static int MergeRule (int x0, int x1);
-static void yyerror(char const * s);
+static void yyerror (char const * s);
int yylex (void);
#define RULE(x) (1 << (x))
#include <stdlib.h>
static void yyerror (char const *);
static int yylex (void);
- static void yyerror(const char *msg);
+ static void yyerror (char const *msg);
%}
%token T_CONSTANT
%%
-void yyerror(const char *msg)
+void
+yyerror (char const *msg)
{
- fprintf (stderr, "error\n");
+ fprintf (stderr, "%s\n", msg);
}
static int lexIndex;
int
main (void)
{
- int index;
- for (index = 0; index < GARBAGE_SIZE; index+=1)
- garbage[index] = 108;
+ int i;
+ for (i = 0; i < GARBAGE_SIZE; i+=1)
+ garbage[i] = 108;
return yyparse ();
}
]])
yylex (void)
{
static char const *input = "ab";
- static int index = 0;
+ static int i = 0;
yylloc.first_line = yylloc.last_line = 1;
- yylloc.first_column = yylloc.last_column = index+1;
- yylval.value = input[index] + 'A' - 'a';
- return input[index++];
+ yylloc.first_column = yylloc.last_column = i + 1;
+ yylval.value = input[i] + 'A' - 'a';
+ return input[i++];
}
static void
AT_DATA_GRAMMAR([glr-regr14.y],
[[
/* Tests:
- - Conflicting actions (split-off parse, which copies lookahead status,
+ - Conflicting actions (split-off parse, which copies lookahead need,
which is necessarily yytrue) and nonconflicting actions (non-split-off
parse) for nondefaulted state: yychar != YYEMPTY.
- - Merged deferred actions (lookahead status and RHS from different stack
+ - Merged deferred actions (lookahead need and RHS from different stack
than the target state) and nonmerged deferred actions (same stack).
- Defaulted state after lookahead: yychar != YYEMPTY.
- Defaulted state after shift: yychar == YYEMPTY.
- - yychar != YYEMPTY but lookahead status is yyfalse (a previous stack has
+ - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has
seen the lookahead but current stack has not).
- Exceeding stack capacity (stack explosion), and thus reallocating
- lookahead status array.
+ lookahead need array.
Note that it does not seem possible to see the initial yychar value during
nondeterministic operation since:
- In order to preserve the initial yychar, only defaulted states may be
}
;
-/* When merging the 2 deferred actions, the lookahead statuses are
- different. */
+/* When merging the 2 deferred actions, the lookahead needs are different. */
merge:
nonconflict1 'a' 'b' nonconflict2 %dprec 1 {
USE ($2); USE ($3);
}
;
-/* yychar != YYEMPTY but lookahead status is yyfalse. */
+/* yychar != YYEMPTY but lookahead need is yyfalse. */
defstate_shift:
{
print_look_ahead ("defstate_shift <- empty string");
yylex (void)
{
static char const *input = "abcdddd";
- static int index = 0;
+ static int i = 0;
yylloc.first_line = yylloc.last_line = 1;
- yylloc.first_column = yylloc.last_column = index+1;
- yylval.value = input[index] + 'A' - 'a';
- return input[index++];
+ yylloc.first_column = yylloc.last_column = i + 1;
+ yylval.value = input[i] + 'A' - 'a';
+ return input[i++];
}
static void