X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/44c2b42dbb835bba585086cdf50f2003fdbef7eb..7d424de14c0385012d328642bec6874c8e6cef17:/data/lalr1.cc?ds=sidebyside diff --git a/data/lalr1.cc b/data/lalr1.cc index e4cbf6f7..bd1faa56 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -1,6 +1,7 @@ # C++ skeleton for Bison -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +# 2010 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 @@ -115,7 +116,7 @@ m4_popdef([b4_dollar_dollar])dnl m4_pushdef([b4_copyright_years], - [2002-2010]) + [2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010]) m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])]) @@ -124,10 +125,10 @@ m4_define([b4_parser_class_name], b4_defines_if([], [b4_fatal([b4_skeleton[: using %%defines is mandatory]])]) -b4_locations_if( -[# Backward compatibility. -m4_define([b4_location_constructors]) -m4_include(b4_pkgdatadir/[location.cc])]) +b4_locations_if([b4_percent_define_ifdef([[location_type]], [], + [# Backward compatibility. + m4_define([b4_location_constructors]) + m4_include(b4_pkgdatadir/[location.cc])])]) m4_include(b4_pkgdatadir/[stack.hh]) b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])]) @@ -150,14 +151,12 @@ dnl FIXME: This is wrong, we want computed header guards. #include #include #include "stack.hh" +]b4_locations_if([b4_percent_define_ifdef([[location_type]], [], + [[#include "location.hh"]])])[ -]b4_namespace_open[ -]b4_locations_if([ class position; - class location;])[ -]b4_variant_if([b4_variant_define])[ -]b4_namespace_close[ - -]b4_locations_if([#include "location.hh"])[ +]b4_variant_if([b4_namespace_open +b4_variant_define +b4_namespace_close])[ /* Enabling traces. */ #ifndef YYDEBUG @@ -177,26 +176,6 @@ dnl FIXME: This is wrong, we want computed header guards. # define YYTOKEN_TABLE ]b4_token_table[ #endif -]b4_locations_if([dnl -[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ -do { \ - if (N) \ - { \ - (Current).begin = (Rhs)[1].location.begin; \ - (Current).end = (Rhs)[N].location.end; \ - } \ - else \ - { \ - (Current).begin = (Current).end = (Rhs)[0].location.end; \ - } \ -} while (false) -#endif]])[ - ]b4_namespace_open[ /// A Bison parser. @@ -408,6 +387,27 @@ b4_percent_code_get[]dnl # endif #endif +]b4_locations_if([dnl +[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (false) +#endif]])[ + /* Suppress unused-variable warnings by "using" E. */ #define YYUSE(e) ((void) (e))