(YYLLOC_DEFAULT): Adjust to do it.
* doc/bison.texinfo (Location Default Action): Fix.
+2002-05-02 Akim Demaille <akim@epita.fr>
+
+ * data/bison.simple (yyparse): Do not implement @$ = @1.
+ (YYLLOC_DEFAULT): Adjust to do it.
+ * doc/bison.texinfo (Location Default Action): Fix.
+
2002-05-02 Akim Demaille <akim@epita.fr>
* src/reader.c (parse_braces): Merge into...
2002-05-02 Akim Demaille <akim@epita.fr>
* src/reader.c (parse_braces): Merge into...
* Revert the C++ namespace changes introduced in 1.31, as they caused too
many portability hassles.
* Revert the C++ namespace changes introduced in 1.31, as they caused too
many portability hassles.
-* Items overflow
- Bison no longer dumps core when there are too many items, it just
- dies.
+* Default locations
+ By an accident of design, the default computation of @$ was
+ performed after another default computation was performed: @$ = @1.
+ The latter is now removed: YYLLOC_DEFAULT is fully responsible of
+ the computation of @$.
* Token end-of-file
The token end of file may be specified by the user, in which case,
* Token end-of-file
The token end of file may be specified by the user, in which case,
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run).
-
- When YYLLOC_DEFAULT is run, CURRENT is set the location of the
- first token. By default, to implement support for ranges, extend
- its range to the last symbol. */
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.last_line = Rhs[[N]].last_line; \
- Current.last_column = Rhs[[N]].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ Current.first_line = Rhs[[1]].first_line; \
+ Current.first_column = Rhs[[1]].first_column; \
+ Current.last_line = Rhs[[N]].last_line; \
+ Current.last_column = Rhs[[N]].last_column;
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
yyval = yyvsp[1-yylen];
#if YYLSP_NEEDED
yyval = yyvsp[1-yylen];
#if YYLSP_NEEDED
- /* Similarly for the default location. Let the user run additional
- commands if for instance locations are ranges. */
- yyloc = yylsp[1-yylen];
+ /* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
+#define YYLLOC_DEFAULT(Current, Rhs, N) \
+ Current.first_line = Rhs[1].first_line; \
+ Current.first_column = Rhs[1].first_column; \
+ Current.last_line = Rhs[N].last_line; \
+ Current.last_column = Rhs[N].last_column;
result) should be modified by @code{YYLLOC_DEFAULT}.
@item
result) should be modified by @code{YYLLOC_DEFAULT}.
@item
-Before @code{YYLLOC_DEFAULT} is executed, the output parser sets @code{@@$}
-to @code{@@1}.
-
-@item
-For consistency with semantic actions, valid indexes for the location array
-range from 1 to @var{n}.
+For consistency with semantic actions, valid indexes for the location
+array range from 1 to @var{n}.
@end itemize
@node Declarations
@end itemize
@node Declarations