48 |
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH |
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH |
49 |
# symbols on RHS. |
# symbols on RHS. |
50 |
m4_define([b4_rhs_value], |
m4_define([b4_rhs_value], |
51 |
[semantic_stack_@<:@m4_eval([$1 - $2])@:>@m4_ifval([$3], [.$3])]) |
[semantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3])]) |
52 |
|
|
53 |
m4_define_default([b4_location_type], [Location]) |
m4_define_default([b4_location_type], [Location]) |
54 |
|
|
64 |
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols |
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols |
65 |
# on RHS. |
# on RHS. |
66 |
m4_define([b4_rhs_location], |
m4_define([b4_rhs_location], |
67 |
[location_stack_@<:@m4_eval([$1 - $2])@:>@]) |
[location_stack_@{m4_eval([$1 - $2])@}]) |
68 |
|
|
69 |
|
|
|
m4_define_default([b4_input_suffix], [.y]) |
|
|
|
|
|
m4_define_default([b4_output_parser_suffix], |
|
|
[m4_translit(b4_input_suffix, [yY], [cC])]) |
|
|
|
|
|
m4_define_default([b4_output_parser_name], |
|
|
[b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]]) |
|
|
|
|
|
|
|
|
m4_define_default([b4_output_header_suffix], |
|
|
[m4_translit(b4_input_suffix, [yY], [hH])]) |
|
|
|
|
|
m4_define_default([b4_output_header_name], |
|
|
[b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]]) |
|
|
|
|
|
m4_define_default([b4_header_guard], |
|
|
[m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name), |
|
|
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])]) |
|
|
|
|
70 |
m4_define([b4_inherit], |
m4_define([b4_inherit], |
71 |
[m4_ifdef([b4_root], |
[m4_ifdef([b4_root], |
72 |
[: public b4_root |
[: public b4_root |
89 |
# We do want M4 expansion after # for CPP macros. |
# We do want M4 expansion after # for CPP macros. |
90 |
m4_changecom() |
m4_changecom() |
91 |
m4_divert(0)dnl |
m4_divert(0)dnl |
92 |
#output "b4_output_header_name" |
@output @output_header_name@ |
93 |
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], |
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], |
94 |
[2002]) |
[2002]) |
95 |
#ifndef b4_header_guard |
#ifndef YYLSP_NEEDED |
96 |
# define b4_header_guard |
# define YYLSP_NEEDED |
97 |
|
|
98 |
#include "stack.hh" |
#include "stack.hh" |
99 |
#include "location.hh" |
#include "location.hh" |
110 |
b4_pre_prologue |
b4_pre_prologue |
111 |
|
|
112 |
/* Line __line__ of __file__. */ |
/* Line __line__ of __file__. */ |
113 |
b4_syncline([__oline__], [__ofile__]) |
b4_syncline([@oline@], [@ofile@]) |
114 |
|
|
115 |
/* Enabling traces. */ |
/* Enabling traces. */ |
116 |
#ifndef YYDEBUG |
#ifndef YYDEBUG |
127 |
[b4_syncline([b4_stype_line], [b4_filename]) |
[b4_syncline([b4_stype_line], [b4_filename]) |
128 |
typedef union b4_stype yystype; |
typedef union b4_stype yystype; |
129 |
/* Line __line__ of __file__. */ |
/* Line __line__ of __file__. */ |
130 |
b4_syncline([__oline__], [__ofile__])], |
b4_syncline([@oline@], [@ofile@])], |
131 |
[typedef int yystype;]) |
[typedef int yystype;]) |
132 |
# define YYSTYPE yystype |
# define YYSTYPE yystype |
133 |
#endif |
#endif |
136 |
b4_post_prologue |
b4_post_prologue |
137 |
|
|
138 |
/* Line __line__ of __file__. */ |
/* Line __line__ of __file__. */ |
139 |
b4_syncline([__oline__], [__ofile__]) |
b4_syncline([@oline@], [@ofile@]) |
140 |
#ifndef YYLLOC_DEFAULT |
#ifndef YYLLOC_DEFAULT |
141 |
# define YYLLOC_DEFAULT(Current, Rhs, N) \ |
# define YYLLOC_DEFAULT(Current, Rhs, N) \ |
142 |
Current.last_line = Rhs[[N]].last_line; \ |
Current.last_line = Rhs[[N]].last_line; \ |
272 |
SemanticType value; |
SemanticType value; |
273 |
LocationType location; |
LocationType location; |
274 |
|
|
275 |
/* @$ and $$. */ |
/* @@$ and $$. */ |
276 |
SemanticType yyval; |
SemanticType yyval; |
277 |
LocationType yyloc; |
LocationType yyloc; |
278 |
|
|
281 |
}; |
}; |
282 |
} |
} |
283 |
|
|
284 |
#endif /* not b4_header_guard */ |
#endif /* ! defined YYLSP_NEEDED */ |
285 |
dnl |
dnl |
286 |
#output "b4_output_prefix[]b4_output_infix[].cc" |
@output @output_parser_name@ |
287 |
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], |
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], |
288 |
[2002]) |
[2002]) |
289 |
|
|
290 |
#include "b4_output_header_name" |
#include @output_header_name@ |
291 |
|
|
292 |
/* Enable debugging if requested. */ |
/* Enable debugging if requested. */ |
293 |
#if YYDEBUG |
#if YYDEBUG |
444 |
} |
} |
445 |
|
|
446 |
/* Line __line__ of __file__. */ |
/* Line __line__ of __file__. */ |
447 |
b4_syncline([__oline__], [__ofile__]) |
b4_syncline([@oline@], [@ofile@]) |
448 |
|
|
449 |
state_stack_.pop (len_); |
state_stack_.pop (len_); |
450 |
semantic_stack_.pop (len_); |
semantic_stack_.pop (len_); |
762 |
|
|
763 |
b4_epilogue |
b4_epilogue |
764 |
dnl |
dnl |
765 |
#output "stack.hh" |
@output stack.hh |
766 |
b4_copyright([2002]) |
b4_copyright([2002]) |
767 |
|
|
768 |
#ifndef BISON_STACK_HH |
#ifndef BISON_STACK_HH |
859 |
|
|
860 |
#endif // not BISON_STACK_HH |
#endif // not BISON_STACK_HH |
861 |
dnl |
dnl |
862 |
#output "location.hh" |
@output location.hh |
863 |
b4_copyright([2002]) |
b4_copyright([2002]) |
864 |
|
|
865 |
#ifndef BISON_LOCATION_HH |
#ifndef BISON_LOCATION_HH |