2 # C++ skeleton for Bison
3 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 ## ---------------- ##
22 ## ---------------- ##
24 # Default Parser class name.
25 m4_define_default([b4_parser_class_name
], [Parser
])
29 ## ----------------- ##
30 ## Semantic Values. ##
31 ## ----------------- ##
34 # b4_lhs_value([TYPE])
35 # --------------------
36 # Expansion of $<TYPE>$.
37 m4_define([b4_lhs_value
],
38 [yyval
[]m4_ifval([$
1], [.$
1])])
41 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
42 # --------------------------------------
43 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
45 m4_define([b4_rhs_value
],
46 [semantic_stack_@
{m4_eval([$
1 - $
2])@
}m4_ifval([$
3], [.$
3])])
48 m4_define_default([b4_location_type
], [Location
])
53 m4_define([b4_lhs_location
],
57 # b4_rhs_location(RULE-LENGTH, NUM)
58 # ---------------------------------
59 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
61 m4_define([b4_rhs_location
],
62 [location_stack_@
{m4_eval([$
1 - $
2])@
}])
65 m4_define([b4_inherit
],
77 m4_define([b4_constructor
],
86 # Constructor's extra arguments.
87 m4_define([b4_parse_param_decl],
88 [m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])])
92 # constructor's extra initialisations.
93 m4_define([b4_parse_param_cons
],
94 [m4_ifset([b4_parse_param
],
96 b4_cc_constructor_calls(b4_parse_param
)])])
97 m4_define([b4_cc_constructor_calls
],
98 [m4_map_sep([b4_cc_constructor_call
], [,
100 m4_define([b4_cc_constructor_call
],
103 # b4_parse_param_vars
104 # -------------------
105 # Extra instance variables.
106 m4_define([b4_parse_param_vars
],
107 [m4_ifset([b4_parse_param
],
109 /* User arguments. */
110 b4_cc_var_decls(b4_parse_param
)])])
111 m4_define([b4_cc_var_decls
],
112 [m4_map_sep([b4_cc_var_decl
], [
114 m4_define([b4_cc_var_decl
],
117 # We do want M4 expansion after # for CPP macros.
120 m4_if(b4_defines_flag
, 0, [],
121 [@output @output_header_name@
122 b4_copyright([C
++ Skeleton parser
for LALR(1) parsing with Bison
],
124 /* FIXME: This is wrong, we want computed header guards.
125 I don't know why the macros are missing now. :( */
126 #ifndef PARSER_HEADER_H
127 # define PARSER_HEADER_H
130 #include "location.hh"
135 /* Using locations. */
136 #define YYLSP_NEEDED ]b4_locations_flag[
138 ]b4_token_defines(b4_tokens
)[
140 /* Copy the first part of user declarations. */
143 ]/* Line __line__ of lalr1.cc. */
144 b4_syncline([@oline@
], [@ofile@
])[
146 /* Enabling traces. */
148 # define YYDEBUG ]b4_debug[
151 /* Enabling verbose error message. */
152 #ifndef YYERROR_VERBOSE
153 # define YYERROR_VERBOSE ]b4_error_verbose[
157 ]m4_ifdef([b4_stype
],
158 [b4_syncline([b4_stype_line
], [b4_filename
])
159 typedef union b4_stype yystype
;
160 /* Line __line__ of lalr1.cc. */
161 b4_syncline([@oline@
], [@ofile@
])],
162 [typedef int yystype
;])[
163 # define YYSTYPE yystype
166 /* Copy the second part of user declarations. */
169 ]/* Line __line__ of lalr1.cc. */
170 b4_syncline([@oline@
], [@ofile@
])[
171 #ifndef YYLLOC_DEFAULT
172 # define YYLLOC_DEFAULT(Current, Rhs, N) \
173 ((Current).end = Rhs[N].end)
178 class ]b4_parser_class_name
[;
180 template < typename P
>
186 struct Traits
< ]b4_parser_class_name
[ >
188 typedef ]b4_int_type_for([b4_translate
])[ TokenNumberType
;
189 typedef ]b4_int_type_for([b4_rhs
])[ RhsNumberType
;
190 typedef int StateType
;
191 typedef yystype SemanticType
;
192 typedef ]b4_location_type
[ LocationType
;
198 class ]b4_parser_class_name b4_inherit
[
202 typedef Traits
< ]b4_parser_class_name
[ >::TokenNumberType TokenNumberType
;
203 typedef Traits
< ]b4_parser_class_name
[ >::RhsNumberType RhsNumberType
;
204 typedef Traits
< ]b4_parser_class_name
[ >::StateType StateType
;
205 typedef Traits
< ]b4_parser_class_name
[ >::SemanticType SemanticType
;
206 typedef Traits
< ]b4_parser_class_name
[ >::LocationType LocationType
;
208 typedef Stack
< StateType
> StateStack
;
209 typedef Stack
< SemanticType
> SemanticStack
;
210 typedef Stack
< LocationType
> LocationStack
;
213 ]b4_parser_class_name
[ (bool debug
,
214 LocationType initlocation
][]b4_param
[]b4_parse_param_decl
[) :
215 ]b4_constructor
[][debug_ (debug
),
217 initlocation_ (initlocation
)]b4_parse_param_cons
[
219 ]b4_parser_class_name
[ (bool debug
][]b4_param
[]b4_parse_param_decl
[) :
220 ]b4_constructor
[][debug_ (debug
),
221 cdebug_ (std::cerr
)]b4_parse_param_cons
[
226 virtual ~]b4_parser_class_name
[ ()
230 virtual int parse ();
234 virtual void lex_ ();
235 virtual void error_ ();
236 virtual void print_ ();
239 StateStack state_stack_
;
240 SemanticStack semantic_stack_
;
241 LocationStack location_stack_
;
244 static const ]b4_int_type_for([b4_pact
])[ pact_
[];
245 static const ]b4_int_type(b4_pact_ninf
, b4_pact_ninf
)[ pact_ninf_
;
246 static const ]b4_int_type_for([b4_defact
])[ defact_
[];
247 static const ]b4_int_type_for([b4_pgoto
])[ pgoto_
[];
248 static const ]b4_int_type_for([b4_defgoto
])[ defgoto_
[];
249 static const ]b4_int_type_for([b4_table
])[ table_
[];
250 static const ]b4_int_type(b4_table_ninf
, b4_table_ninf
)[ table_ninf_
;
251 static const ]b4_int_type_for([b4_check
])[ check_
[];
252 static const ]b4_int_type_for([b4_r1
])[ r1_
[];
253 static const ]b4_int_type_for([b4_r2
])[ r2_
[];
255 #if YYDEBUG || YYERROR_VERBOSE
256 static const char* const name_
[];
259 /* More tables, for debugging. */
261 static const RhsNumberType rhs_
[];
262 static const ]b4_int_type_for([b4_prhs
])[ prhs_
[];
263 static const ]b4_int_type_for([b4_rline
])[ rline_
[];
264 static const ]b4_int_type_for([b4_stos
])[ stos_
[];
265 static const ]b4_int_type_for([b4_toknum
])[ token_number_
[];
268 /* Even more tables. */
269 static inline TokenNumberType
translate_ (int token
);
272 static const int eof_
;
273 /* LAST_ -- Last index in TABLE_. */
274 static const int last_
;
275 static const int nnts_
;
276 static const int empty_
;
277 static const int final_
;
278 static const int terror_
;
279 static const int errcode_
;
280 static const int ntokens_
;
281 static const unsigned user_token_number_max_
;
282 static const TokenNumberType undef_token_
;
291 std::ostream
&cdebug_
;
293 /* Lookahead and lookahead in internal form. */
300 /* Semantic value and location of lookahead token. */
302 LocationType location
;
308 /* Initial location. */
309 LocationType initlocation_
;
310 ]b4_parse_param_vars
[
314 #endif /* ! defined PARSER_HEADER_H */]
316 @output @output_parser_name@
317 b4_copyright([C
++ Skeleton parser
for LALR(1) parsing with Bison
],
320 m4_if(b4_defines_flag
, 0, [], [#include @output_header_name@])[
322 /* Enable debugging if requested. */
324 # define YYCDEBUG if (debug_) cdebug_
326 # define YYCDEBUG if (0) cdebug_
327 #endif /* !YYDEBUG */
329 #define YYACCEPT goto yyacceptlab
330 #define YYABORT goto yyabortlab
331 #define YYERROR goto yyerrlab1
335 yy::]b4_parser_class_name
[::parse ()
340 /* Initialize the stacks. The initial state will be pushed in
341 yynewstate, since the latter expects the semantical and the
342 location values to have been already stored, initialize these
343 stacks with a primary value. */
344 state_stack_
= StateStack (0);
345 semantic_stack_
= SemanticStack (1);
346 location_stack_
= LocationStack (1);
352 location
= initlocation_
;
354 YYCDEBUG
<< "Starting parse" << std::endl
;
358 state_stack_
.push (state_
);
359 YYCDEBUG
<< "Entering state " << state_
<< std::endl
;
365 /* Try to take a decision without lookahead. */
367 if (n_
== pact_ninf_
)
370 /* Read a lookahead token. */
371 if (looka_
== empty_
)
373 YYCDEBUG
<< "Reading a token: ";
377 /* Convert token to internal form. */
382 YYCDEBUG
<< "Now at end of input." << std::endl
;
386 ilooka_
= translate_ (looka_
);
390 YYCDEBUG
<< "Next token is " << looka_
391 << " (" << name_
[ilooka_
];
393 YYCDEBUG
<< ')' << std::endl
;
399 if (n_
< 0 || last_
< n_
|| check_
[n_
] != ilooka_
)
402 /* Reduce or error. */
406 if (n_
== table_ninf_
)
421 /* Shift the lookahead token. */
423 YYCDEBUG
<< "Shifting token " << looka_
424 << " (" << name_
[ilooka_
] << "), ";
427 /* Discard the token being shifted unless it is eof. */
431 semantic_stack_
.push (value
);
432 location_stack_
.push (location
);
434 /* Count tokens shifted since error; after three, turn off error
442 /* Default action. */
444 n_
= defact_
[state_
];
454 yyval
= semantic_stack_
[len_
- 1];
455 yyloc
= location_stack_
[len_
- 1];
459 yyval
= semantic_stack_
[0];
460 yyloc
= location_stack_
[0];
466 // Short files will use "unsigned char" for line numbers,
467 // in which case they will be output as character litterals
469 unsigned yylno
= rline_
[n_
];
470 YYCDEBUG
<< "Reducing via rule " << n_
- 1
471 << " (line " << yylno
<< "), ";
472 for (]b4_int_type_for([b4_prhs
])[ i
= prhs_
[n_
];
474 YYCDEBUG
<< name_
[rhs_
[i
]] << ' ';
475 YYCDEBUG
<< "-> " << name_
[r1_
[n_
]] << std::endl
;
481 Slice
< LocationType
, LocationStack
> slice (location_stack_
, len_
);
482 YYLLOC_DEFAULT (yyloc
, slice
, len_
);
490 ]/* Line __line__ of lalr1.cc. */
491 b4_syncline([@oline@
], [@ofile@
])[
493 state_stack_
.pop (len_
);
494 semantic_stack_
.pop (len_
);
495 location_stack_
.pop (len_
);
500 YYCDEBUG
<< "state stack now";
501 for (StateStack::ConstIterator i
= state_stack_
.begin ();
502 i
!= state_stack_
.end (); ++i
)
503 YYCDEBUG
<< ' ' << *i
;
504 YYCDEBUG
<< std::endl
;
508 semantic_stack_
.push (yyval
);
509 location_stack_
.push (yyloc
);
511 /* Shift the result of the reduction. */
513 state_
= pgoto_
[n_
- ntokens_
] + state_stack_
[0];
514 if (0 <= state_
&& state_
<= last_
&& check_
[state_
] == state_stack_
[0])
515 state_
= table_
[state_
];
517 state_
= defgoto_
[n_
- ntokens_
];
520 /* Report and recover from errors. This is very incomplete. */
522 /* If not already recovering from an error, report this error. */
529 if (pact_ninf_
< n_
&& n_
< last_
)
531 message
= "syntax error, unexpected ";
532 message
+= name_
[ilooka_
];
535 /* Start YYX at -YYN if negative to avoid negative indexes in
537 int xbegin
= n_
< 0 ? -n_
: 0;
538 /* Stay within bounds of both yycheck and yytname. */
539 int checklim
= last_
- n_
;
540 int xend
= checklim
< ntokens_
? checklim
: ntokens_
;
541 for (int x
= xbegin
; x
< xend
; ++x
)
542 if (check_
[x
+ n_
] == x
&& x
!= terror_
)
547 for (int x1
= xbegin
; x1
< xend
; ++x1
)
548 if (check_
[x1
+ n_
] == x1
&& x1
!= terror_
)
550 message
+= (!count
++) ? ", expecting " : " or ";
551 message
+= name_
[x1
];
558 message
= "syntax error";
564 /*----------------------------------------------------.
565 | yyerrlab1 -- error raised explicitly by an action. |
566 `----------------------------------------------------*/
570 /* If just tried and failed to reuse lookahead token after an
571 error, discard it. */
573 /* Return failure if at end of input. */
577 YYCDEBUG
<< "Discarding token " << looka_
578 << " (" << name_
[ilooka_
] << ")." << std::endl
;
583 /* Else will try to reuse lookahead token after shifting the error
591 if (n_
!= pact_ninf_
)
594 if (0 <= n_
&& n_
<= last_
&& check_
[n_
] == terror_
)
602 /* Pop the current state because it cannot handle the error token. */
603 if (state_stack_
.height () == 1)
609 if (stos_
[state_
] < ntokens_
)
611 YYCDEBUG
<< "Error: popping token "
612 << token_number_
[stos_
[state_
]]
613 << " (" << name_
[stos_
[state_
]];
615 YYPRINT (stderr
, token_number_
[stos_
[state_
]],
616 semantic_stack_
.top ());
618 YYCDEBUG
<< ')' << std::endl
;
622 YYCDEBUG
<< "Error: popping nonterminal ("
623 << name_
[stos_
[state_
]] << ')' << std::endl
;
628 state_
= (state_stack_
.pop (), state_stack_
[0]);
629 semantic_stack_
.pop ();
630 location_stack_
.pop ();;
635 YYCDEBUG
<< "Error: state stack now";
636 for (StateStack::ConstIterator i
= state_stack_
.begin ();
637 i
!= state_stack_
.end (); ++i
)
638 YYCDEBUG
<< ' ' << *i
;
639 YYCDEBUG
<< std::endl
;
647 YYCDEBUG
<< "Shifting error token, ";
649 semantic_stack_
.push (value
);
650 location_stack_
.push (location
);
665 yy::]b4_parser_class_name
[::lex_ ()
668 looka_
= yylex (&value
, &location
);
670 looka_
= yylex (&value
);
674 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
676 const ]b4_int_type(b4_pact_ninf
, b4_pact_ninf
) yy::b4_parser_class_name::pact_ninf_
= b4_pact_ninf
[;
677 const ]b4_int_type_for([b4_pact
])[
678 yy::]b4_parser_class_name
[::pact_
[] =
683 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
684 doesn't specify something else to do. Zero means the default is an
686 const ]b4_int_type_for([b4_defact
])[
687 yy::]b4_parser_class_name
[::defact_
[] =
692 /* YYPGOTO[NTERM-NUM]. */
693 const ]b4_int_type_for([b4_pgoto
])[
694 yy::]b4_parser_class_name
[::pgoto_
[] =
699 /* YYDEFGOTO[NTERM-NUM]. */
700 const ]b4_int_type_for([b4_defgoto
])[
701 yy::]b4_parser_class_name
[::defgoto_
[] =
706 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
707 positive, shift that token. If negative, reduce the rule which
708 number is the opposite. If zero, do what YYDEFACT says. */
709 const ]b4_int_type(b4_table_ninf
, b4_table_ninf
) yy::b4_parser_class_name::table_ninf_
= b4_table_ninf
[;
710 const ]b4_int_type_for([b4_table
])[
711 yy::]b4_parser_class_name
[::table_
[] =
717 const ]b4_int_type_for([b4_check
])[
718 yy::]b4_parser_class_name
[::check_
[] =
724 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
725 symbol of state STATE-NUM. */
726 const ]b4_int_type_for([b4_stos
])[
727 yy::]b4_parser_class_name
[::stos_
[] =
732 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal token number corresponding
734 const ]b4_int_type_for([b4_toknum
])[
735 yy::]b4_parser_class_name
[::token_number_
[] =
741 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
742 const ]b4_int_type_for([b4_r1
])[
743 yy::]b4_parser_class_name
[::r1_
[] =
748 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
749 const ]b4_int_type_for([b4_r2
])[
750 yy::]b4_parser_class_name
[::r2_
[] =
755 #if YYDEBUG || YYERROR_VERBOSE
756 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
757 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
759 const yy::]b4_parser_class_name
[::name_
[] =
766 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
767 const yy::]b4_parser_class_name
[::RhsNumberType
768 yy::]b4_parser_class_name
[::rhs_
[] =
773 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
775 const ]b4_int_type_for([b4_prhs
])[
776 yy::]b4_parser_class_name
[::prhs_
[] =
781 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
782 const ]b4_int_type_for([b4_rline
])[
783 yy::]b4_parser_class_name
[::rline_
[] =
789 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
790 yy::]b4_parser_class_name
[::TokenNumberType
791 yy::]b4_parser_class_name
[::translate_ (int token
)
794 const TokenNumberType
799 if ((unsigned) token
<= user_token_number_max_
)
800 return translate_table
[token
];
805 const int yy::]b4_parser_class_name
[::eof_
= 0;
806 const int yy::]b4_parser_class_name
[::last_
= ]b4_last
[;
807 const int yy::]b4_parser_class_name
[::nnts_
= ]b4_nterms_number
[;
808 const int yy::]b4_parser_class_name
[::empty_
= -2;
809 const int yy::]b4_parser_class_name
[::final_
= ]b4_final_state_number
[;
810 const int yy::]b4_parser_class_name
[::terror_
= 1;
811 const int yy::]b4_parser_class_name
[::errcode_
= 256;
812 const int yy::]b4_parser_class_name
[::ntokens_
= ]b4_tokens_number
[;
814 const unsigned yy::]b4_parser_class_name
[::user_token_number_max_
= ]b4_user_token_number_max
[;
815 const yy::]b4_parser_class_name
[::TokenNumberType
yy::]b4_parser_class_name
[::undef_token_
= ]b4_undef_token_number
[;
820 b4_copyright([Stack handling
for Bison C
++ parsers
], [2002, 2003])[
822 #ifndef BISON_STACK_HH
823 # define BISON_STACK_HH
829 template < class T
, class S
= std::deque
< T
> >
834 typedef typename
S::iterator Iterator
;
835 typedef typename
S::const_iterator ConstIterator
;
841 Stack (unsigned n
) : seq_ (n
)
847 operator [] (unsigned i
)
854 operator [] (unsigned i
) const
881 inline ConstIterator
begin () const { return seq_
.begin (); }
882 inline ConstIterator
end () const { return seq_
.end (); }
889 template < class T
, class S
= Stack
< T
> >
894 Slice (const S
& stack
,
895 unsigned range
) : stack_ (stack
),
902 operator [] (unsigned i
) const
904 return stack_
[range_
- i
];
914 #endif // not BISON_STACK_HH]
917 b4_copyright([Position
class for Bison C
++ parsers
], [2002, 2003])[
921 ** Define the Location class.
924 #ifndef BISON_POSITION_HH
925 # define BISON_POSITION_HH
932 /** \brief Abstract a Position. */
936 /** \brief Initial column number. */
937 static const unsigned int initial_column
= 0;
938 /** \brief Initial line number. */
939 static const unsigned int initial_line
= 1;
941 /** \name Ctor & dtor.
944 /** \brief Construct a Position. */
948 column (initial_column
)
954 /** \name Line and Column related manipulators
957 /** \brief (line related) Advance to the COUNT next lines. */
958 inline void lines (int count
= 1)
960 column
= initial_column
;
964 /** \brief (column related) Advance to the COUNT next columns. */
965 inline void columns (int count
= 1)
967 int leftmost
= initial_column
;
968 int current
= column
;
969 if (leftmost
<= current
+ count
)
972 column
= initial_column
;
977 /** \brief File name to which this position refers. */
978 std::string filename
;
979 /** \brief Current line number. */
981 /** \brief Current column number. */
985 /** \brief Add and assign a Position. */
986 inline const Position
&
987 operator+= (Position
& res
, const int width
)
993 /** \brief Add two Position objects. */
994 inline const Position
995 operator+ (const Position
& begin
, const int width
)
997 Position res
= begin
;
1001 /** \brief Add and assign a Position. */
1002 inline const Position
&
1003 operator-= (Position
& res
, const int width
)
1005 return res
+= -width
;
1008 /** \brief Add two Position objects. */
1009 inline const Position
1010 operator- (const Position
& begin
, const int width
)
1012 return begin
+ -width
;
1015 /** \brief Intercept output stream redirection.
1016 ** \param ostr the destination output stream
1017 ** \param pos a reference to the Position to redirect
1019 inline std::ostream
&
1020 operator<< (std::ostream
& ostr
, const Position
& pos
)
1022 if (!pos
.filename
.empty ())
1023 ostr
<< pos
.filename
<< ':';
1024 return ostr
<< pos
.line
<< '.' << pos
.column
;
1028 #endif // not BISON_POSITION_HH]
1030 b4_copyright([Location
class for Bison C
++ parsers
], [2002, 2003])[
1033 ** \file location.hh
1034 ** Define the Location class.
1037 #ifndef BISON_LOCATION_HH
1038 # define BISON_LOCATION_HH
1040 # include <iostream>
1042 # include "position.hh"
1047 /** \brief Abstract a Location. */
1050 /** \name Ctor & dtor.
1053 /** \brief Construct a Location. */
1062 /** \name Line and Column related manipulators
1065 /** \brief Reset initial location to final location. */
1066 inline void step (void)
1071 /** \brief Extend the current location to the COUNT next columns. */
1072 inline void columns (unsigned int count
= 1)
1077 /** \brief Extend the current location to the COUNT next lines. */
1078 inline void lines (unsigned int count
= 1)
1086 /** \brief Beginning of the located region. */
1088 /** \brief End of the located region. */
1092 /** \brief Join two Location objects to create a Location. */
1093 inline const Location
operator+ (const Location
& begin
, const Location
& end
)
1095 Location res
= begin
;
1100 /** \brief Add two Location objects */
1101 inline const Location
operator+ (const Location
& begin
, unsigned width
)
1103 Location res
= begin
;
1104 res
.columns (width
);
1108 /** \brief Add and assign a Location */
1109 inline Location
&operator+= (Location
& res
, unsigned width
)
1111 res
.columns (width
);
1115 /** \brief Intercept output stream redirection.
1116 ** \param ostr the destination output stream
1117 ** \param loc a reference to the Location to redirect
1119 ** Avoid duplicate information.
1121 inline std::ostream
& operator<< (std::ostream
& ostr
, const Location
& loc
)
1123 Position last
= loc
.end
- 1;
1125 if (loc
.begin
.filename
!= last
.filename
)
1126 ostr
<< '-' << last
;
1127 else if (loc
.begin
.line
!= last
.line
)
1128 ostr
<< '-' << last
.line
<< '.' << last
.column
;
1129 else if (loc
.begin
.column
!= last
.column
)
1130 ostr
<< '-' << last
.column
;
1136 #endif // not BISON_LOCATION_HH]