m4_divert(-1)
# C++ skeleton for Bison
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA
-m4_include([c.m4])
-
## ---------------- ##
## Default values. ##
## ---------------- ##
# We do want M4 expansion after # for CPP macros.
m4_changecom()
m4_divert(0)dnl
-@output @output_header_name@
+m4_if(b4_defines_flag, 0, [],
+[@output @output_header_name@
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
- [2002])[
+ [2002, 2003])[
/* FIXME: This is wrong, we want computed header guards.
I don't know why the macros are missing now. :( */
#ifndef PARSER_HEADER_H
/* Copy the first part of user declarations. */
]b4_pre_prologue[
-]/* Line __line__ of __file__. */
+]/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])[
/* Enabling traces. */
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename])
typedef union b4_stype yystype;
-/* Line __line__ of __file__. */
+/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])],
[typedef int yystype;])[
# define YYSTYPE yystype
/* Copy the second part of user declarations. */
]b4_post_prologue[
-]/* Line __line__ of __file__. */
+]/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])[
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
+ Current.last = Rhs[N].last;
#endif
namespace yy
}
#endif /* ! defined PARSER_HEADER_H */]
-dnl
+])dnl
@output @output_parser_name@
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
- [2002])[
+ [2002, 2003])
-#include @output_header_name@
+m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[
/* Enable debugging if requested. */
#if YYDEBUG
int nerrs = 0;
int errstatus = 0;
- /* Initialize stack. */
+ /* Initialize the stacks. The initial state will be pushed in
+ yynewstate, since the latter expects the semantical and the
+ location values to have been already stored, initialize these
+ stacks with a primary value. */
state_stack_ = StateStack (0);
semantic_stack_ = SemanticStack (1);
location_stack_ = LocationStack (1);
goto yyacceptlab;
/* Shift the lookahead token. */
+#if YYDEBUG
YYCDEBUG << "Shifting token " << looka_
- << " (" << name_[ilooka_] << "), ";
+ << " (" << name_[ilooka_] << "), ";
+#endif
/* Discard the token being shifted unless it is eof. */
if (looka_ != eof_)
]b4_actions[
}
-]/* Line __line__ of __file__. */
+]/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])[
state_stack_.pop (len_);
}
/* Pop the current state because it cannot handle the error token. */
- if (!state_stack_.height ())
+ if (state_stack_.height () == 1)
goto yyabortlab;
#if YYDEBUG
]b4_epilogue
dnl
@output stack.hh
-b4_copyright([2002])[
+b4_copyright([2002, 2003])[
#ifndef BISON_STACK_HH
# define BISON_STACK_HH
#endif // not BISON_STACK_HH]
dnl
@output location.hh
-b4_copyright([2002])[
+b4_copyright([2002, 2003])[
#ifndef BISON_LOCATION_HH
# define BISON_LOCATION_HH