19 |
|
|
20 |
m4_include([c.m4]) |
m4_include([c.m4]) |
21 |
|
|
22 |
|
## ---------------- ## |
23 |
|
## Default values. ## |
24 |
|
## ---------------- ## |
25 |
|
|
26 |
|
# Stack parameters. |
27 |
|
m4_define_default([b4_stack_depth_init], [200]) |
28 |
|
|
29 |
|
# Default Parser class name. |
30 |
|
m4_define_default([b4_parser_class_name], [Parser]) |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
## ----------------- ## |
35 |
|
## Semantic Values. ## |
36 |
|
## ----------------- ## |
37 |
|
|
38 |
|
|
39 |
# b4_lhs_value([TYPE]) |
# b4_lhs_value([TYPE]) |
40 |
# -------------------- |
# -------------------- |
41 |
# Expansion of $<TYPE>$. |
# Expansion of $<TYPE>$. |
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_ltype], [Location]) |
m4_define_default([b4_location_type], [Location]) |
54 |
|
|
55 |
# b4_lhs_location() |
# b4_lhs_location() |
56 |
# ----------------- |
# ----------------- |
162 |
|
|
163 |
namespace yy |
namespace yy |
164 |
{ |
{ |
165 |
class b4_name; |
class b4_parser_class_name; |
166 |
|
|
167 |
template < typename P > |
template < typename P > |
168 |
struct Traits |
struct Traits |
170 |
}; |
}; |
171 |
|
|
172 |
template < > |
template < > |
173 |
struct Traits< b4_name > |
struct Traits< b4_parser_class_name > |
174 |
{ |
{ |
175 |
typedef b4_int_type_for([b4_translate]) TokenNumberType; |
typedef b4_int_type_for([b4_translate]) TokenNumberType; |
176 |
typedef b4_int_type_for([b4_rhs]) RhsNumberType; |
typedef b4_int_type_for([b4_rhs]) RhsNumberType; |
177 |
typedef int StateType; |
typedef int StateType; |
178 |
typedef yystype SemanticType; |
typedef yystype SemanticType; |
179 |
typedef b4_ltype LocationType; |
typedef b4_location_type LocationType; |
180 |
}; |
}; |
181 |
} |
} |
182 |
|
|
183 |
namespace yy |
namespace yy |
184 |
{ |
{ |
185 |
class b4_name b4_inherit |
class b4_parser_class_name b4_inherit |
186 |
{ |
{ |
187 |
public: |
public: |
188 |
|
|
189 |
typedef Traits< b4_name >::TokenNumberType TokenNumberType; |
typedef Traits< b4_parser_class_name >::TokenNumberType TokenNumberType; |
190 |
typedef Traits< b4_name >::RhsNumberType RhsNumberType; |
typedef Traits< b4_parser_class_name >::RhsNumberType RhsNumberType; |
191 |
typedef Traits< b4_name >::StateType StateType; |
typedef Traits< b4_parser_class_name >::StateType StateType; |
192 |
typedef Traits< b4_name >::SemanticType SemanticType; |
typedef Traits< b4_parser_class_name >::SemanticType SemanticType; |
193 |
typedef Traits< b4_name >::LocationType LocationType; |
typedef Traits< b4_parser_class_name >::LocationType LocationType; |
194 |
|
|
195 |
typedef Stack< StateType > StateStack; |
typedef Stack< StateType > StateStack; |
196 |
typedef Stack< SemanticType > SemanticStack; |
typedef Stack< SemanticType > SemanticStack; |
197 |
typedef Stack< LocationType > LocationStack; |
typedef Stack< LocationType > LocationStack; |
198 |
|
|
199 |
#if YYLSP_NEEDED |
#if YYLSP_NEEDED |
200 |
b4_name (bool debug, |
b4_parser_class_name (bool debug, |
201 |
LocationType initlocation[]b4_param) : |
LocationType initlocation[]b4_param) : |
202 |
b4_constructor[]debug_ (debug), |
b4_constructor[]debug_ (debug), |
203 |
cdebug_ (std::cerr), |
cdebug_ (std::cerr), |
204 |
initlocation_ (initlocation) |
initlocation_ (initlocation) |
205 |
#else |
#else |
206 |
b4_name (bool debug[]b4_param) : |
b4_parser_class_name (bool debug[]b4_param) : |
207 |
b4_constructor[]debug_ (debug), |
b4_constructor[]debug_ (debug), |
208 |
cdebug_ (std::cerr) |
cdebug_ (std::cerr) |
209 |
#endif |
#endif |
210 |
{ |
{ |
211 |
} |
} |
212 |
|
|
213 |
virtual ~b4_name () |
virtual ~b4_parser_class_name () |
214 |
{ |
{ |
215 |
} |
} |
216 |
|
|
313 |
#endif /* !YYDEBUG */ |
#endif /* !YYDEBUG */ |
314 |
|
|
315 |
int |
int |
316 |
yy::b4_name::parse () |
yy::b4_parser_class_name::parse () |
317 |
{ |
{ |
318 |
int nerrs = 0; |
int nerrs = 0; |
319 |
int errstatus = 0; |
int errstatus = 0; |
623 |
} |
} |
624 |
|
|
625 |
void |
void |
626 |
yy::b4_name::lex_ () |
yy::b4_parser_class_name::lex_ () |
627 |
{ |
{ |
628 |
#if YYLSP_NEEDED |
#if YYLSP_NEEDED |
629 |
looka_ = yylex (&value, &location); |
looka_ = yylex (&value, &location); |
634 |
|
|
635 |
/* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing |
/* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing |
636 |
STATE-NUM. */ |
STATE-NUM. */ |
637 |
const b4_int_type_for([b4_pact]) yy::b4_name::pact_ninf_ = b4_pact_ninf; |
const b4_int_type_for([b4_pact]) yy::b4_parser_class_name::pact_ninf_ = b4_pact_ninf; |
638 |
const b4_int_type_for([b4_pact]) |
const b4_int_type_for([b4_pact]) |
639 |
yy::b4_name::pact_[[]] = |
yy::b4_parser_class_name::pact_[[]] = |
640 |
{ |
{ |
641 |
b4_pact |
b4_pact |
642 |
}; |
}; |
645 |
doesn't specify something else to do. Zero means the default is an |
doesn't specify something else to do. Zero means the default is an |
646 |
error. */ |
error. */ |
647 |
const b4_int_type_for([b4_defact]) |
const b4_int_type_for([b4_defact]) |
648 |
yy::b4_name::defact_[[]] = |
yy::b4_parser_class_name::defact_[[]] = |
649 |
{ |
{ |
650 |
b4_defact |
b4_defact |
651 |
}; |
}; |
652 |
|
|
653 |
/* YYPGOTO[[NTERM-NUM]]. */ |
/* YYPGOTO[[NTERM-NUM]]. */ |
654 |
const b4_int_type_for([b4_pgoto]) |
const b4_int_type_for([b4_pgoto]) |
655 |
yy::b4_name::pgoto_[[]] = |
yy::b4_parser_class_name::pgoto_[[]] = |
656 |
{ |
{ |
657 |
b4_pgoto |
b4_pgoto |
658 |
}; |
}; |
659 |
|
|
660 |
/* YYDEFGOTO[[NTERM-NUM]]. */ |
/* YYDEFGOTO[[NTERM-NUM]]. */ |
661 |
const b4_int_type_for([b4_defgoto]) |
const b4_int_type_for([b4_defgoto]) |
662 |
yy::b4_name::defgoto_[[]] = |
yy::b4_parser_class_name::defgoto_[[]] = |
663 |
{ |
{ |
664 |
b4_defgoto |
b4_defgoto |
665 |
}; |
}; |
667 |
/* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If |
/* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If |
668 |
positive, shift that token. If negative, reduce the rule which |
positive, shift that token. If negative, reduce the rule which |
669 |
number is the opposite. If zero, do what YYDEFACT says. */ |
number is the opposite. If zero, do what YYDEFACT says. */ |
670 |
const b4_int_type_for([b4_table]) yy::b4_name::table_ninf_ = b4_table_ninf; |
const b4_int_type_for([b4_table]) yy::b4_parser_class_name::table_ninf_ = b4_table_ninf; |
671 |
const b4_int_type_for([b4_table]) |
const b4_int_type_for([b4_table]) |
672 |
yy::b4_name::table_[[]] = |
yy::b4_parser_class_name::table_[[]] = |
673 |
{ |
{ |
674 |
b4_table |
b4_table |
675 |
}; |
}; |
676 |
|
|
677 |
/* YYCHECK. */ |
/* YYCHECK. */ |
678 |
const b4_int_type_for([b4_check]) |
const b4_int_type_for([b4_check]) |
679 |
yy::b4_name::check_[[]] = |
yy::b4_parser_class_name::check_[[]] = |
680 |
{ |
{ |
681 |
b4_check |
b4_check |
682 |
}; |
}; |
685 |
/* STOS_[[STATE-NUM]] -- The (internal number of the) accessing |
/* STOS_[[STATE-NUM]] -- The (internal number of the) accessing |
686 |
symbol of state STATE-NUM. */ |
symbol of state STATE-NUM. */ |
687 |
const b4_int_type_for([b4_stos]) |
const b4_int_type_for([b4_stos]) |
688 |
yy::b4_name::stos_[[]] = |
yy::b4_parser_class_name::stos_[[]] = |
689 |
{ |
{ |
690 |
b4_stos |
b4_stos |
691 |
}; |
}; |
693 |
/* TOKEN_NUMBER_[[YYLEX-NUM]] -- Internal token number corresponding |
/* TOKEN_NUMBER_[[YYLEX-NUM]] -- Internal token number corresponding |
694 |
to YYLEX-NUM. */ |
to YYLEX-NUM. */ |
695 |
const b4_int_type_for([b4_toknum]) |
const b4_int_type_for([b4_toknum]) |
696 |
yy::b4_name::token_number_[[]] = |
yy::b4_parser_class_name::token_number_[[]] = |
697 |
{ |
{ |
698 |
b4_toknum |
b4_toknum |
699 |
}; |
}; |
701 |
|
|
702 |
/* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */ |
/* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */ |
703 |
const b4_int_type_for([b4_r1]) |
const b4_int_type_for([b4_r1]) |
704 |
yy::b4_name::r1_[[]] = |
yy::b4_parser_class_name::r1_[[]] = |
705 |
{ |
{ |
706 |
b4_r1 |
b4_r1 |
707 |
}; |
}; |
708 |
|
|
709 |
/* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */ |
/* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */ |
710 |
const b4_int_type_for([b4_r2]) |
const b4_int_type_for([b4_r2]) |
711 |
yy::b4_name::r2_[[]] = |
yy::b4_parser_class_name::r2_[[]] = |
712 |
{ |
{ |
713 |
b4_r2 |
b4_r2 |
714 |
}; |
}; |
717 |
/* YYTNAME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM. |
/* YYTNAME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM. |
718 |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
719 |
const char* |
const char* |
720 |
const yy::b4_name::name_[[]] = |
const yy::b4_parser_class_name::name_[[]] = |
721 |
{ |
{ |
722 |
b4_tname |
b4_tname |
723 |
}; |
}; |
725 |
|
|
726 |
#if YYDEBUG |
#if YYDEBUG |
727 |
/* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
/* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
728 |
const yy::b4_name::RhsNumberType |
const yy::b4_parser_class_name::RhsNumberType |
729 |
yy::b4_name::rhs_[[]] = |
yy::b4_parser_class_name::rhs_[[]] = |
730 |
{ |
{ |
731 |
b4_rhs |
b4_rhs |
732 |
}; |
}; |
734 |
/* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in |
/* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in |
735 |
YYRHS. */ |
YYRHS. */ |
736 |
const b4_int_type_for([b4_prhs]) |
const b4_int_type_for([b4_prhs]) |
737 |
yy::b4_name::prhs_[[]] = |
yy::b4_parser_class_name::prhs_[[]] = |
738 |
{ |
{ |
739 |
b4_prhs |
b4_prhs |
740 |
}; |
}; |
741 |
|
|
742 |
/* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */ |
/* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */ |
743 |
const b4_int_type_for([b4_rline]) |
const b4_int_type_for([b4_rline]) |
744 |
yy::b4_name::rline_[[]] = |
yy::b4_parser_class_name::rline_[[]] = |
745 |
{ |
{ |
746 |
b4_rline |
b4_rline |
747 |
}; |
}; |
748 |
#endif |
#endif |
749 |
|
|
750 |
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
751 |
yy::b4_name::TokenNumberType |
yy::b4_parser_class_name::TokenNumberType |
752 |
yy::b4_name::translate_ (int token) |
yy::b4_parser_class_name::translate_ (int token) |
753 |
{ |
{ |
754 |
static |
static |
755 |
const TokenNumberType |
const TokenNumberType |
763 |
return undef_token_; |
return undef_token_; |
764 |
} |
} |
765 |
|
|
766 |
const int yy::b4_name::eof_ = 0; |
const int yy::b4_parser_class_name::eof_ = 0; |
767 |
const int yy::b4_name::last_ = b4_last; |
const int yy::b4_parser_class_name::last_ = b4_last; |
768 |
const int yy::b4_name::nnts_ = b4_nterms_number; |
const int yy::b4_parser_class_name::nnts_ = b4_nterms_number; |
769 |
const int yy::b4_name::empty_ = -2; |
const int yy::b4_parser_class_name::empty_ = -2; |
770 |
const int yy::b4_name::final_ = b4_final_state_number; |
const int yy::b4_parser_class_name::final_ = b4_final_state_number; |
771 |
const int yy::b4_name::terror_ = 1; |
const int yy::b4_parser_class_name::terror_ = 1; |
772 |
const int yy::b4_name::errcode_ = 256; |
const int yy::b4_parser_class_name::errcode_ = 256; |
773 |
const int yy::b4_name::ntokens_ = b4_tokens_number; |
const int yy::b4_parser_class_name::ntokens_ = b4_tokens_number; |
774 |
const int yy::b4_name::initdepth_ = b4_initdepth; |
const int yy::b4_parser_class_name::initdepth_ = b4_stack_depth_init; |
775 |
|
|
776 |
const unsigned yy::b4_name::user_token_number_max_ = b4_user_token_number_max; |
const unsigned yy::b4_parser_class_name::user_token_number_max_ = b4_user_token_number_max; |
777 |
const yy::b4_name::TokenNumberType yy::b4_name::undef_token_ = b4_undef_token_number; |
const yy::b4_parser_class_name::TokenNumberType yy::b4_name::undef_token_ = b4_undef_token_number; |
778 |
|
|
779 |
b4_epilogue |
b4_epilogue |
780 |
dnl |
dnl |