/* File: rule_lhs_phrase.cpp Date and Time: Fri Jan 30 18:55:23 2015 */ #include "rule_lhs_phrase.h" using namespace NS_yacco2_T_enum;// enumerate using namespace NS_yacco2_err_symbols;// error symbols using namespace NS_yacco2_k_symbols;// lrk using namespace NS_yacco2_terminals;// terminals using namespace NS_yacco2_characters;// rc using namespace yacco2;// yacco2 library using namespace NS_rule_lhs_phrase;// grammar's ns // first set terminals fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ no_rules_entries_ = 16; per_rule_s_table_[0] = new Per_rule_s_reuse_table(); per_rule_s_table_[1] = new Per_rule_s_reuse_table(); per_rule_s_table_[2] = new Per_rule_s_reuse_table(); per_rule_s_table_[3] = new Per_rule_s_reuse_table(); per_rule_s_table_[4] = new Per_rule_s_reuse_table(); per_rule_s_table_[5] = new Per_rule_s_reuse_table(); per_rule_s_table_[6] = new Per_rule_s_reuse_table(); per_rule_s_table_[7] = new Per_rule_s_reuse_table(); per_rule_s_table_[8] = new Per_rule_s_reuse_table(); per_rule_s_table_[9] = new Per_rule_s_reuse_table(); per_rule_s_table_[10] = new Per_rule_s_reuse_table(); per_rule_s_table_[11] = new Per_rule_s_reuse_table(); per_rule_s_table_[12] = new Per_rule_s_reuse_table(); per_rule_s_table_[13] = new Per_rule_s_reuse_table(); per_rule_s_table_[14] = new Per_rule_s_reuse_table(); per_rule_s_table_[15] = new Per_rule_s_reuse_table(); } Crule_lhs_phrase:: Crule_lhs_phrase() :yacco2::CAbs_fsm ("rule_lhs_phrase.lex" ,"1.0" ,"24 mar 2004" ,false ,"Parse a rule's ``lhs'' directive." ,"Fri Jan 30 18:55:23 2015 " ,S1_Crule_lhs_phrase){ rule_lhs_phrase_ = 0; } Crule_lhs_phrase::~Crule_lhs_phrase(){ for(int x = 0;x < 16;++x){ ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; } } bool Crule_lhs_phrase::failed(){ return false; } void Crule_lhs_phrase::op(){ if(rule_lhs_phrase_ != 0){ delete rule_lhs_phrase_; rule_lhs_phrase_ = 0; } rule_lhs_phrase_ = new T_rule_lhs_phrase; rule_lhs_phrase_->set_rc(*parser__->start_token__,__FILE__,__LINE__); AST* t = new AST(*rule_lhs_phrase_); rule_lhs_phrase_->phrase_tree(t); } int Crule_lhs_phrase::rhs_to_rules_mapping_[39] = { -1 ,0 // subrule 1 for rule 1 ,1 // subrule 2 for rule 2 ,1 // subrule 3 for rule 2 ,2 // subrule 4 for rule 3 ,2 // subrule 5 for rule 3 ,3 // subrule 6 for rule 4 ,4 // subrule 7 for rule 5 ,4 // subrule 8 for rule 5 ,4 // subrule 9 for rule 5 ,4 // subrule 10 for rule 5 ,4 // subrule 11 for rule 5 ,4 // subrule 12 for rule 5 ,4 // subrule 13 for rule 5 ,5 // subrule 14 for rule 6 ,5 // subrule 15 for rule 6 ,6 // subrule 16 for rule 7 ,6 // subrule 17 for rule 7 ,7 // subrule 18 for rule 8 ,7 // subrule 19 for rule 8 ,8 // subrule 20 for rule 9 ,8 // subrule 21 for rule 9 ,9 // subrule 22 for rule 10 ,10 // subrule 23 for rule 11 ,10 // subrule 24 for rule 11 ,10 // subrule 25 for rule 11 ,10 // subrule 26 for rule 11 ,10 // subrule 27 for rule 11 ,10 // subrule 28 for rule 11 ,11 // subrule 29 for rule 12 ,11 // subrule 30 for rule 12 ,12 // subrule 31 for rule 13 ,12 // subrule 32 for rule 13 ,13 // subrule 33 for rule 14 ,14 // subrule 34 for rule 15 ,14 // subrule 35 for rule 15 ,14 // subrule 36 for rule 15 ,15 // subrule 37 for rule 16 ,15 // subrule 38 for rule 16 }; void Crule_lhs_phrase:: add_sdc_to_directive(yacco2::CAbs_lr1_sym* Dir,T_syntax_code* Sdc){ using namespace NS_yacco2_T_enum; using namespace NS_yacco2_terminals; yacco2::INT eid = Dir->enumerated_id__; switch (eid){ case T_Enum::T_T_user_declaration_: { T_user_declaration* k = (T_user_declaration*)Dir; k->syntax_code(Sdc); break; } case T_Enum::T_T_constructor_: { T_constructor* k = (T_constructor*)Dir; k->syntax_code(Sdc); break; } case T_Enum::T_T_destructor_: { T_destructor* k = (T_destructor*)Dir; k->syntax_code(Sdc); break; } case T_Enum::T_T_op_: { T_op* k = (T_op*)Dir; k->syntax_code(Sdc); break; } case T_Enum::T_T_user_implementation_: { T_user_implementation* k = (T_user_implementation*)Dir; k->syntax_code(Sdc); break; } default: { CAbs_lr1_sym* sym = new Err_improper_directive; sym->set_rc(*Dir,__FILE__,__LINE__); RSVP_FSM(sym); parser__->set_stop_parse(true); return; } } rule_lhs_phrase_->add_directive_to_lhs(Dir,parser__); } Rrule_lhs_phrase::Rrule_lhs_phrase(yacco2::Parser* P) :CAbs_lr1_sym ("Rrule_lhs_phrase",0,Crule_lhs_phrase::R_Rrule_lhs_phrase_,P,false,false){ } void Rrule_lhs_phrase::sr1(){ Crule_lhs_phrase* fsm = (Crule_lhs_phrase*)rule_info__.parser__->fsm_tbl__; RSVP(fsm->rule_lhs_phrase_); fsm->rule_lhs_phrase_ = 0; } Rlhs::Rlhs(yacco2::Parser* P) :CAbs_lr1_sym ("Rlhs",0,Crule_lhs_phrase::R_Rlhs_,P,false,false){ } void Rlhs::sr2(){ rule_info__.parser__->set_abort_parse(true); } Rpotential_directives::Rpotential_directives(yacco2::Parser* P) :CAbs_lr1_sym ("Rpotential_directives",0,Crule_lhs_phrase::R_Rpotential_directives_,P,false,false){ } Rmust_directive_phrase::Rmust_directive_phrase(yacco2::Parser* P) :CAbs_lr1_sym ("Rmust_directive_phrase",0,Crule_lhs_phrase::R_Rmust_directive_phrase_,P,false,false){ } void Rmust_directive_phrase::sr1(){ struct SF{ Rdirective_cweb_k* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; Rlint* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; Rmust_directive* p3__; State* s3__; bool abort3__; Rule_s_reuse_entry* rule_s_reuse_entry3__; Rsyntax_code* p4__; State* s4__; bool abort4__; Rule_s_reuse_entry* rule_s_reuse_entry4__; Rlint* p5__; State* s5__; bool abort5__; Rule_s_reuse_entry* rule_s_reuse_entry5__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(5); AST* cwebt = sf->p1__->cweb_t_; Rmust_directive* dir = sf->p3__; Rsyntax_code* sdc = sf->p4__; if(cwebt != 0) sdc->syntax_code_->add_cweb_marker(cwebt); Crule_lhs_phrase* fsm = (Crule_lhs_phrase*)rule_info__.parser__->fsm_tbl__; fsm->add_sdc_to_directive(dir->directive_,sdc->syntax_code_); } Rmust_directive::Rmust_directive(yacco2::Parser* P) :CAbs_lr1_sym ("Rmust_directive",0,Crule_lhs_phrase::R_Rmust_directive_,P,false,false){ } void Rmust_directive::ctor(){ directive_ = 0; } void Rmust_directive::sr1(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_user_declaration* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rmust_directive::sr2(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_user_implementation* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rmust_directive::sr3(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_constructor* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rmust_directive::sr4(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_destructor* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rmust_directive::sr5(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_op* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rmust_directive::sr6(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; CAbs_lr1_sym* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = 0; sf->p2__->set_auto_delete(true); CAbs_lr1_sym* sym = new Err_bad_directive; sym->set_rc(*sf->p2__,__FILE__,__LINE__); RSVP(sym); rule_info__.parser__->set_stop_parse(true); } void Rmust_directive::sr7(){ CAbs_lr1_sym* sym = new Err_no_directive_present; sym->set_rc(*rule_info__.parser__->current_token(),__FILE__,__LINE__); RSVP(sym); rule_info__.parser__->set_stop_parse(true); } Rclose_brace::Rclose_brace(yacco2::Parser* P) :CAbs_lr1_sym ("Rclose_brace",0,Crule_lhs_phrase::R_Rclose_brace_,P,false,false){ } void Rclose_brace::sr1(){ CAbs_lr1_sym* sym = new Err_no_close_brace; sym->set_rc(*rule_info__.parser__->current_token(),__FILE__,__LINE__); RSVP(sym); rule_info__.parser__->set_stop_parse(true); } Rmaybe_more_directives::Rmaybe_more_directives(yacco2::Parser* P) :CAbs_lr1_sym ("Rmaybe_more_directives",0,Crule_lhs_phrase::R_Rmaybe_more_directives_,P,false,false){ } Rmaybe_directive_phrases::Rmaybe_directive_phrases(yacco2::Parser* P) :CAbs_lr1_sym ("Rmaybe_directive_phrases",0,Crule_lhs_phrase::R_Rmaybe_directive_phrases_,P,false,false){ } Rmaybe_directive_phrase::Rmaybe_directive_phrase(yacco2::Parser* P) :CAbs_lr1_sym ("Rmaybe_directive_phrase",0,Crule_lhs_phrase::R_Rmaybe_directive_phrase_,P,false,false){ } void Rmaybe_directive_phrase::sr1(){ struct SF{ Rcweb_k* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; Rlint* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; Rdirective* p3__; State* s3__; bool abort3__; Rule_s_reuse_entry* rule_s_reuse_entry3__; Rsyntax_code* p4__; State* s4__; bool abort4__; Rule_s_reuse_entry* rule_s_reuse_entry4__; Rlint* p5__; State* s5__; bool abort5__; Rule_s_reuse_entry* rule_s_reuse_entry5__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(5); AST* cwebt = sf->p1__->cweb_t_; Rdirective* dir = sf->p3__; Rsyntax_code* sdc = sf->p4__; if(cwebt != 0) sdc->syntax_code_->add_cweb_marker(cwebt); Crule_lhs_phrase* fsm = (Crule_lhs_phrase*)rule_info__.parser__->fsm_tbl__; fsm->add_sdc_to_directive(dir->directive_,sdc->syntax_code_); } void Rmaybe_directive_phrase::sr2(){ struct SF{ Rdirective* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; Rsyntax_code* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; Rlint* p3__; State* s3__; bool abort3__; Rule_s_reuse_entry* rule_s_reuse_entry3__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(3); Rdirective* dir = sf->p1__; Rsyntax_code* sdc = sf->p2__; Crule_lhs_phrase* fsm = (Crule_lhs_phrase*)rule_info__.parser__->fsm_tbl__; fsm->add_sdc_to_directive(dir->directive_,sdc->syntax_code_); } Rdirective_phrase::Rdirective_phrase(yacco2::Parser* P) :CAbs_lr1_sym ("Rdirective_phrase",0,Crule_lhs_phrase::R_Rdirective_phrase_,P,false,false){ } void Rdirective_phrase::sr1(){ struct SF{ Rcweb_k* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; Rlint* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; Rdirective* p3__; State* s3__; bool abort3__; Rule_s_reuse_entry* rule_s_reuse_entry3__; Rsyntax_code* p4__; State* s4__; bool abort4__; Rule_s_reuse_entry* rule_s_reuse_entry4__; Rlint* p5__; State* s5__; bool abort5__; Rule_s_reuse_entry* rule_s_reuse_entry5__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(5); AST* cwebt = sf->p1__->cweb_t_; Rdirective* dir = sf->p3__; Rsyntax_code* sdc = sf->p4__; if(cwebt != 0) sdc->syntax_code_->add_cweb_marker(cwebt); Crule_lhs_phrase* fsm = (Crule_lhs_phrase*)rule_info__.parser__->fsm_tbl__; fsm->add_sdc_to_directive(dir->directive_,sdc->syntax_code_); } Rdirective::Rdirective(yacco2::Parser* P) :CAbs_lr1_sym ("Rdirective",0,Crule_lhs_phrase::R_Rdirective_,P,false,false){ } void Rdirective::ctor(){ directive_ = 0; } void Rdirective::sr1(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_user_declaration* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rdirective::sr2(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_user_implementation* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rdirective::sr3(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_constructor* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rdirective::sr4(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_destructor* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rdirective::sr5(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_op* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = sf->p2__; } void Rdirective::sr6(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; CAbs_lr1_sym* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); directive_ = 0; sf->p2__->set_auto_delete(true); CAbs_lr1_sym* sym = new Err_bad_directive; sym->set_rc(*sf->p2__,__FILE__,__LINE__); RSVP(sym); rule_info__.parser__->set_stop_parse(true); } Rsyntax_code::Rsyntax_code(yacco2::Parser* P) :CAbs_lr1_sym ("Rsyntax_code",0,Crule_lhs_phrase::R_Rsyntax_code_,P,false,false){ } void Rsyntax_code::ctor(){ syntax_code_ = 0; } void Rsyntax_code::sr1(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_syntax_code* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); syntax_code_ = sf->p2__; } void Rsyntax_code::sr2(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; CAbs_lr1_sym* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); RSVP(sf->p2__); rule_info__.parser__->set_stop_parse(true); } Rlint::Rlint(yacco2::Parser* P) :CAbs_lr1_sym ("Rlint",0,Crule_lhs_phrase::R_Rlint_,P,false,false){ } Rcweb_marker::Rcweb_marker(yacco2::Parser* P) :CAbs_lr1_sym ("Rcweb_marker",0,Crule_lhs_phrase::R_Rcweb_marker_,P,false,false){ } void Rcweb_marker::ctor(){ cweb_t_ = 0; } void Rcweb_marker::sr1(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_cweb_comment* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); T_cweb_comment* k = sf->p2__; AST* cwebk_t_ = new AST(*k); cweb_t_ = new AST(); T_cweb_marker* cw = new T_cweb_marker(cweb_t_); cw->set_rc(*k,__FILE__,__LINE__); AST::set_content(*cweb_t_,*cw); AST::join_pts(*cweb_t_,*cwebk_t_); } Rdirective_cweb_k::Rdirective_cweb_k(yacco2::Parser* P) :CAbs_lr1_sym ("Rdirective_cweb_k",0,Crule_lhs_phrase::R_Rdirective_cweb_k_,P,false,false){ } void Rdirective_cweb_k::ctor(){ cweb_t_ = 0; } void Rdirective_cweb_k::sr2(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_cweb_comment* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); T_cweb_comment* k = sf->p2__; AST* cwebk_t_ = new AST(*k); cweb_t_ = new AST(); T_cweb_marker* cw = new T_cweb_marker(cweb_t_); cw->set_rc(*k,__FILE__,__LINE__); AST::set_content(*cweb_t_,*cw); AST::join_pts(*cweb_t_,*cwebk_t_); } void Rdirective_cweb_k::sr3(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; Err_comment_overrun* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); RSVP(sf->p2__); rule_info__.parser__->set_stop_parse(true); } Rcweb_k::Rcweb_k(yacco2::Parser* P) :CAbs_lr1_sym ("Rcweb_k",0,Crule_lhs_phrase::R_Rcweb_k_,P,false,false){ } void Rcweb_k::ctor(){ cweb_t_ = 0; } void Rcweb_k::sr1(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; T_cweb_comment* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); T_cweb_comment* k = sf->p2__; AST* cwebk_t_ = new AST(*k); cweb_t_ = new AST(); T_cweb_marker* cw = new T_cweb_marker(cweb_t_); cw->set_rc(*k,__FILE__,__LINE__); AST::set_content(*cweb_t_,*cw); AST::join_pts(*cweb_t_,*cwebk_t_); } void Rcweb_k::sr2(){ struct SF{ LR1_parallel_operator* p1__; State* s1__; bool abort1__; Rule_s_reuse_entry* rule_s_reuse_entry1__; Err_comment_overrun* p2__; State* s2__; bool abort2__; Rule_s_reuse_entry* rule_s_reuse_entry2__; }; SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(2); RSVP(sf->p2__); rule_info__.parser__->set_stop_parse(true); }