[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01-fyi-comment.patch
From: |
Akim Demaille |
Subject: |
01-fyi-comment.patch |
Date: |
Thu, 27 Dec 2001 18:57:46 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/output.c (prepare): Drop the muscle `ntbase' which
duplicates ntokens.
* src/bison.simple: Formatting/comment changes.
Use YYNTOKENS only, which is documented, but not YYNTBASE, which
is an undocumented synonym.
Index: src/bison.simple
--- src/bison.simple Sat, 22 Dec 2001 17:58:53 +0100 akim
+++ src/bison.simple Sun, 23 Dec 2001 11:49:57 +0100 akim
@@ -190,32 +190,39 @@
/* Tokens. */
%%tokendef
-#define YYFINAL %%final
-#define YYFLAG %%flag
-#define YYNTBASE %%ntbase
-#define YYLAST %%last
-
-#define YYNTOKENS %%ntokens
-#define YYNNTS %%nnts
-#define YYNRULES %%nrules
-#define YYNSTATES %%nstates
-#define YYMAXUTOK %%maxtok
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL %%final
+#define YYFLAG %%flag
+#define YYLAST %%last
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS %%ntokens
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS %%nnts
+/* YYNRULES -- Number of rules. */
+#define YYNRULES %%nrules
+/* YYNRULES -- Number of states. */
+#define YYNSTATES %%nstates
+#define YYMAXUTOK %%maxtok
-/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym)
-/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const char yytranslate[] =
{
%%translate
};
#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
static const short yyprhs[] =
{
%%prhs
};
+/* YYRHS -- A `0'-separated list of the rules' RHS. */
static const short yyrhs[] =
{
%%rhs
@@ -229,7 +236,8 @@
#endif
#if (YYDEBUG) || YYERROR_VERBOSE
-/* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
+/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
%%tname
@@ -262,21 +270,28 @@
%%defact
};
+/* YYPGOTO[NTERM-NUM]. */
static const short yydefgoto[] =
{
%%defgoto
};
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const short yypact[] =
{
%%pact
};
+/* YYPGOTO[NTERM-NUM]. */
static const short yypgoto[] =
{
%%pgoto
};
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says. */
static const short yytable[] =
{
%%table
@@ -331,14 +346,14 @@
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
- yylval = (Value); \
+ yylval = (Value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
- yyerror ("syntax error: cannot back up"); \
+ yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
while (0)
@@ -928,11 +943,11 @@ yyreduce:
yyn = yyr1[yyn];
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
- yystate = yydefgoto[yyn - YYNTBASE];
+ yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
Index: src/output.c
--- src/output.c Sat, 22 Dec 2001 17:58:53 +0100 akim
+++ src/output.c Sat, 22 Dec 2001 18:45:27 +0100 akim
@@ -1012,7 +1012,6 @@
MUSCLE_INSERT_INT ("debug", debug_flag);
MUSCLE_INSERT_INT ("final", final_state);
MUSCLE_INSERT_INT ("maxtok", max_user_token_number);
- MUSCLE_INSERT_INT ("ntbase", ntokens);
MUSCLE_INSERT_INT ("error-verbose", error_verbose);
MUSCLE_INSERT_STRING ("prefix", spec_name_prefix);
@@ -1057,7 +1056,7 @@
for (i = ntokens; i < nsyms; i++)
/* don't make these for dummy nonterminals made by gensym. */
if (*tags[i] != '@')
- fprintf (out, "# define\tNT%s\t%d\n", tags[i], i);
+ fprintf (out, "# define NT%s\t%d\n", tags[i], i);
}
fprintf (out, "\n#endif /* not %s */\n", macro_name);
Index: src/reader.c
--- src/reader.c Sun, 16 Dec 2001 17:44:24 +0100 akim
+++ src/reader.c Sat, 22 Dec 2001 18:45:20 +0100 akim
@@ -1738,12 +1738,12 @@
if (c != '\0')
continue;
- obstack_fgrow2 (&tokendefs, "# define\t%s\t%d\n",
+ obstack_fgrow2 (&tokendefs, "# define %s\t%d\n",
symbol, bp->user_token_number);
if (semantic_parser)
/* FIXME: This is probably wrong, and should be just as
above. --akim. */
- obstack_fgrow2 (&tokendefs, "# define\tT%s\t%d\n", symbol, bp->value);
+ obstack_fgrow2 (&tokendefs, "# define T%s\t%d\n", symbol, bp->value);
}
obstack_1grow (&tokendefs, 0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 01-fyi-comment.patch,
Akim Demaille <=