mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
Let position and location be PODs.
* data/location.cc (position::initialize, location::initialize): New. (position::position, location::location): Define only if b4_location_constructors is defined. * data/lalr1.cc (b4_location_constructors): Define it for backward compatibility. * doc/bison.texinfo (Initial Action Decl): Use initialize.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,4 +1,14 @@
|
|||||||
2005-11-12 Akim <akim@epita.fr>
|
2005-11-12 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
Let position and location be PODs.
|
||||||
|
* data/location.cc (position::initialize, location::initialize): New.
|
||||||
|
(position::position, location::location): Define only if
|
||||||
|
b4_location_constructors is defined.
|
||||||
|
* data/lalr1.cc (b4_location_constructors): Define it for backward
|
||||||
|
compatibility.
|
||||||
|
* doc/bison.texinfo (Initial Action Decl): Use initialize.
|
||||||
|
|
||||||
|
2005-11-12 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* data/lalr1.cc: Move the body of the ctor and dtor into the
|
* data/lalr1.cc: Move the body of the ctor and dtor into the
|
||||||
parser file (instead of the header).
|
parser file (instead of the header).
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ m4_divert(-1)
|
|||||||
# 02110-1301 USA
|
# 02110-1301 USA
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
# Backward compatibility.
|
||||||
|
m4_define([b4_location_constructors])
|
||||||
m4_include(b4_pkgdatadir/[location.cc])
|
m4_include(b4_pkgdatadir/[location.cc])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004, 2005])[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
** \file position.hh
|
** \file position.hh
|
||||||
** Define the position class.
|
** Define the yy::position class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BISON_POSITION_HH
|
#ifndef BISON_POSITION_HH
|
||||||
@@ -43,18 +43,22 @@ namespace yy
|
|||||||
/// Abstract a position.
|
/// Abstract a position.
|
||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
/** \name Ctor & dtor.
|
|
||||||
** \{ */
|
|
||||||
public:
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
position () :
|
position ()
|
||||||
filename (0),
|
: filename (0), line (1), column (0)
|
||||||
line (1),
|
|
||||||
column (0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/** \} */
|
|
||||||
|
|
||||||
|
])[
|
||||||
|
/// Initialization.
|
||||||
|
inline void initialize (]b4_filename_type[* fn)
|
||||||
|
{
|
||||||
|
filename = fn;
|
||||||
|
line = 1;
|
||||||
|
column = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** \name Line and Column related manipulators
|
/** \name Line and Column related manipulators
|
||||||
** \{ */
|
** \{ */
|
||||||
@@ -136,7 +140,7 @@ b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004, 2005])[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
** \file location.hh
|
** \file location.hh
|
||||||
** Define the location class.
|
** Define the yy::location class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BISON_LOCATION_HH
|
#ifndef BISON_LOCATION_HH
|
||||||
@@ -152,17 +156,21 @@ namespace yy
|
|||||||
/// Abstract a location.
|
/// Abstract a location.
|
||||||
class location
|
class location
|
||||||
{
|
{
|
||||||
/** \name Ctor & dtor.
|
|
||||||
** \{ */
|
|
||||||
public:
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [
|
||||||
/// Construct a location.
|
/// Construct a location.
|
||||||
location () :
|
location ()
|
||||||
begin (),
|
: begin (), end ()
|
||||||
end ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/** \} */
|
|
||||||
|
|
||||||
|
])[
|
||||||
|
/// Initialization.
|
||||||
|
inline void initialize (]b4_filename_type[* fn)
|
||||||
|
{
|
||||||
|
begin.initialize (fn);
|
||||||
|
end = begin;
|
||||||
|
}
|
||||||
|
|
||||||
/** \name Line and Column related manipulators
|
/** \name Line and Column related manipulators
|
||||||
** \{ */
|
** \{ */
|
||||||
|
|||||||
@@ -3800,7 +3800,7 @@ For instance, if your locations use a file name, you may use
|
|||||||
%parse-param @{ char const *file_name @};
|
%parse-param @{ char const *file_name @};
|
||||||
%initial-action
|
%initial-action
|
||||||
@{
|
@{
|
||||||
@@$.begin.filename = @@$.end.filename = file_name;
|
@@$.initialize (file_name);
|
||||||
@};
|
@};
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user