/*
 File: enumerate_grammar.cpp
 Date and Time: Fri Jan 30 18:55:09 2015 
*/
#include "enumerate_grammar.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_enumerate_grammar;// grammar's ns
// first set terminals
fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){
 no_rules_entries_ = 9;
 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();
}
  Cenumerate_grammar::
  Cenumerate_grammar()
    :yacco2::CAbs_fsm
      ("enumerate_grammar.lex"
      ,"1.0"
      ,"26 sept. 2005"
      ,false
      ,"Dump aid: Enumerate grammar's components"
      ,"Fri Jan 30 18:55:09 2015 "
      ,S1_Cenumerate_grammar){
    
  }
 
Cenumerate_grammar::~Cenumerate_grammar(){

  for(int x = 0;x < 9;++x){
   ///delete fsm_rules_reuse_table.per_rule_s_table_[x];
  }
} 

  bool Cenumerate_grammar::failed(){
      return false;
  }
  void Cenumerate_grammar::op(){
    rule_no_ = 0;
	subrule_no_ = 0;
	elem_no_ = 0;
        enum_subrule_no_ = 0;
  
}
int Cenumerate_grammar::rhs_to_rules_mapping_[17] = {
 -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
 ,3 // subrule 5 for rule 4
 ,4 // subrule 6 for rule 5
 ,4 // subrule 7 for rule 5
 ,5 // subrule 8 for rule 6
 ,6 // subrule 9 for rule 7
 ,7 // subrule 10 for rule 8
 ,7 // subrule 11 for rule 8
 ,8 // subrule 12 for rule 9
 ,8 // subrule 13 for rule 9
 ,8 // subrule 14 for rule 9
 ,8 // subrule 15 for rule 9
 ,8 // subrule 16 for rule 9
}; 
Rfirst_set_rules::Rfirst_set_rules(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rfirst_set_rules",0,Cenumerate_grammar::R_Rfirst_set_rules_,P,false,false){
}

Rrules::Rrules(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rrules",0,Cenumerate_grammar::R_Rrules_,P,false,false){
}

Rrule::Rrule(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rrule",0,Cenumerate_grammar::R_Rrule_,P,false,false){
}

Rrule_def::Rrule_def(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rrule_def",0,Cenumerate_grammar::R_Rrule_def_,P,false,false){
}

void Rrule_def::sr1(){
  struct SF{
   rule_def* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	fsm->subrule_no_ = 0;
	fsm->elem_no_ = 0;
	++fsm->rule_no_;
    char buf[128];
	KCHARP rule_no =	"%i";
	sprintf(buf,rule_no,fsm->rule_no_);
    sf->p1__->grammar_s_enumerate(buf);
  
}

Rsubrules::Rsubrules(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rsubrules",0,Cenumerate_grammar::R_Rsubrules_,P,false,false){
}

Rsubrule::Rsubrule(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rsubrule",0,Cenumerate_grammar::R_Rsubrule_,P,false,false){
}

Rsubrule_def::Rsubrule_def(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rsubrule_def",0,Cenumerate_grammar::R_Rsubrule_def_,P,false,false){
}

void Rsubrule_def::sr1(){
  struct SF{
   T_subrule_def* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	++fsm->subrule_no_;
        ++fsm->enum_subrule_no_;
        sf->p1__->its_grammar_s_pos(fsm->enum_subrule_no_);
	fsm->elem_no_ = 0;    
    char buf[128];
	KCHARP subrule_no =	"%i.%i";
	sprintf(buf,subrule_no,fsm->rule_no_,fsm->subrule_no_);
    sf->p1__->grammar_s_enumerate(buf);
  
}

Relements::Relements(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Relements",0,Cenumerate_grammar::R_Relements_,P,false,false){
}

Relement::Relement(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Relement",0,Cenumerate_grammar::R_Relement_,P,false,false){
}

void Relement::sr1(){
  struct SF{
   refered_rule* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	++fsm->elem_no_;    
    char buf[128];
	KCHARP elem_no =	"%i.%i.%i";
	sprintf(buf,elem_no,fsm->rule_no_,fsm->subrule_no_,fsm->elem_no_);
    sf->p1__->grammar_s_enumerate(buf);
    sf->p1__->element_pos(fsm->elem_no_);
  
}

void Relement::sr2(){
  struct SF{
   refered_T* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	++fsm->elem_no_;    
    char buf[128];
	KCHARP elem_no =	"%i.%i.%i";
	sprintf(buf,elem_no,fsm->rule_no_,fsm->subrule_no_,fsm->elem_no_);
    sf->p1__->grammar_s_enumerate(buf);
    sf->p1__->element_pos(fsm->elem_no_);
  
}

void Relement::sr3(){
  struct SF{
   T_eosubrule* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	++fsm->elem_no_;    
    char buf[128];
	KCHARP elem_no =	"%i.%i.%i";
	sprintf(buf,elem_no,fsm->rule_no_,fsm->subrule_no_,fsm->elem_no_);
    sf->p1__->grammar_s_enumerate(buf);
    sf->p1__->element_pos(fsm->elem_no_);
  
}

void Relement::sr4(){
  struct SF{
   T_called_thread_eosubrule* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	++fsm->elem_no_;    
    char buf[128];
	KCHARP elem_no =	"%i.%i.%i";
	sprintf(buf,elem_no,fsm->rule_no_,fsm->subrule_no_,fsm->elem_no_);
    sf->p1__->grammar_s_enumerate(buf);
    sf->p1__->element_pos(fsm->elem_no_);
  
}

void Relement::sr5(){
  struct SF{
   T_null_call_thread_eosubrule* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
  };
  SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1);
  
    Cenumerate_grammar* fsm = (Cenumerate_grammar*)rule_info__.parser__->fsm_tbl__;
	++fsm->elem_no_;    
    char buf[128];
	KCHARP elem_no =	"%i.%i.%i";
	sprintf(buf,elem_no,fsm->rule_no_,fsm->subrule_no_,fsm->elem_no_);
    sf->p1__->grammar_s_enumerate(buf);
    sf->p1__->element_pos(fsm->elem_no_);
  
}

