/*
 File: o2_lcl_opts.cpp
 Date and Time: Fri Jan 30 18:55:17 2015 
*/
#include "o2_lcl_opts.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_o2_lcl_opts;// 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();
}
  Co2_lcl_opts::
  Co2_lcl_opts()
    :yacco2::CAbs_fsm
      ("o2_lcl_opts.lex"
      ,"1.0"
      ,"21 Nov. 2002"
      ,false
      ,"\\O2's command line options dispatcher."
      ,"Fri Jan 30 18:55:17 2015 "
      ,S1_Co2_lcl_opts){
    
    err_sw_ = 'n';t_sw_ = 'n';
    prt_sw_ = 'n';
    parm_cnt_ = 1;

  }
 
Co2_lcl_opts::~Co2_lcl_opts(){

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

  bool Co2_lcl_opts::failed(){
      return false;
  }
  void Co2_lcl_opts::op(){
    parser__->set_use_all_shift_on();
  
}
int Co2_lcl_opts::rhs_to_rules_mapping_[24] = {
 -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
 ,3 // subrule 7 for rule 4
 ,4 // subrule 8 for rule 5
 ,4 // subrule 9 for rule 5
 ,4 // subrule 10 for rule 5
 ,4 // subrule 11 for rule 5
 ,5 // subrule 12 for rule 6
 ,5 // subrule 13 for rule 6
 ,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
 ,8 // subrule 22 for rule 9
 ,8 // subrule 23 for rule 9
}; 
Ryacco2_options::Ryacco2_options(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Ryacco2_options",0,Co2_lcl_opts::R_Ryacco2_options_,P,false,false){
}

void Ryacco2_options::op(){
  sstrace_rulesss
 
    TOKEN_GAGGLE* err_queue = (TOKEN_GAGGLE*)rule_info__.parser__->error_queue();
    if(err_queue ->empty()) return;
  
}
Reog::Reog(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Reog",0,Co2_lcl_opts::R_Reog_,P,false,false){
}

void Reog::sr2(){
  struct SF{
   CAbs_lr1_sym* 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);
  
      rule_info__.parser__->set_use_all_shift_off();
      CAbs_lr1_sym* sym = new Err_bad_cmd_lne_opt;
      sym->set_rc(*sf->p1__,__FILE__,__LINE__);
      ADD_TOKEN_TO_ERROR_QUEUE(*sym);
      rule_info__.parser__->set_stop_parse(true);
    
}

Rws_k::Rws_k(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rws_k",0,Co2_lcl_opts::R_Rws_k_,P,false,false){
}

Rws_k_s::Rws_k_s(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rws_k_s",0,Co2_lcl_opts::R_Rws_k_s_,P,false,false){
}

Rws::Rws(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rws",0,Co2_lcl_opts::R_Rws_,P,false,false){
}

void Rws::sr2(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_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);
  
      sf->p2__->set_auto_delete(true);
    
}

void Rws::sr3(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_eol* 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);
  
      sf->p2__->set_auto_delete(true);
    
}

void Rws::sr4(){
  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);
  
      rule_info__.parser__->set_use_all_shift_off();
      ADD_TOKEN_TO_ERROR_QUEUE(*sf->p2__);
      rule_info__.parser__->set_stop_parse(true);
    
}

Rfile::Rfile(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rfile",0,Co2_lcl_opts::R_Rfile_,P,false,false){
}


      void Rfile::edit_file(CAbs_lr1_sym* Sym){
        Co2_lcl_opts* fsm = (Co2_lcl_opts*)rule_info__.parser__->fsm_tbl__;      
        using namespace NS_yacco2_err_symbols;
        using namespace NS_yacco2_k_symbols;
        std::ifstream ifile;
        ifile.open(fsm->file_to_compile_.c_str());
	    if (ifile.good()){
	      ifile.close(); 
	      return;
	    }
        CAbs_lr1_sym* sym = new Err_bad_filename(fsm->file_to_compile_);
        sym->set_rc(*Sym,__FILE__,__LINE__);
        rule_info__.parser__->add_token_to_error_queue(*sym);
        rule_info__.parser__->set_stop_parse(true);
      }
  
void Rfile::sr1(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_unquoted_string* 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_unquoted_string* uqstr = sf->p2__;
      Co2_lcl_opts* fsm = (Co2_lcl_opts*)rule_info__.parser__->fsm_tbl__;      
      fsm->file_to_compile_ += uqstr->unquoted_string()->c_str();
      ++fsm->parm_cnt_;
      edit_file(uqstr);
      sf->p2__->set_auto_delete(true);
    
}

void Rfile::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);
  
      rule_info__.parser__->set_use_all_shift_off();
      ADD_TOKEN_TO_ERROR_QUEUE(*sf->p2__);
      rule_info__.parser__->set_stop_parse(true);
    
}

void Rfile::sr3(){
  
      rule_info__.parser__->set_use_all_shift_off();
      CAbs_lr1_sym* sym = new Err_no_filename();
        sym->set_rc(*rule_info__.parser__->current_token(),__FILE__,__LINE__);
        ADD_TOKEN_TO_ERROR_QUEUE(*sym);
        rule_info__.parser__->set_stop_parse(true);
    
}

void Rfile::sr4(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_xc_str* 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_xc_str* xcstr = sf->p2__;
      Co2_lcl_opts* fsm = (Co2_lcl_opts*)rule_info__.parser__->fsm_tbl__;      
      fsm->file_to_compile_ += xcstr->c_string()->c_str();
      ++fsm->parm_cnt_;
      edit_file(xcstr);
    
}

Rparms_epi::Rparms_epi(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rparms_epi",0,Co2_lcl_opts::R_Rparms_epi_,P,false,false){
}

Rparms::Rparms(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rparms",0,Co2_lcl_opts::R_Rparms_,P,false,false){
}

Rspec_parm::Rspec_parm(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rspec_parm",0,Co2_lcl_opts::R_Rspec_parm_,P,false,false){
}

void Rspec_parm::sr1(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_option_t* 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);
  
      Co2_lcl_opts* fsm = (Co2_lcl_opts*)rule_info__.parser__->fsm_tbl__;      
      ++fsm->parm_cnt_;
      fsm->t_sw_ = 'y';
      sf->p2__->set_auto_delete(true);
    
}

void Rspec_parm::sr2(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_option_err* 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);
  
      Co2_lcl_opts* fsm = (Co2_lcl_opts*)rule_info__.parser__->fsm_tbl__;      
      ++fsm->parm_cnt_;
      fsm->err_sw_ = 'y';
      sf->p2__->set_auto_delete(true);
    
}

void Rspec_parm::sr3(){
  struct SF{
   LR1_parallel_operator* p1__;
   State* s1__;
   bool abort1__;
   Rule_s_reuse_entry* rule_s_reuse_entry1__;
   T_option_p* 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);
  
      Co2_lcl_opts* fsm = (Co2_lcl_opts*)rule_info__.parser__->fsm_tbl__;      
      ++fsm->parm_cnt_;
      fsm->prt_sw_ = 'y';
      sf->p2__->set_auto_delete(true);
    
}

void Rspec_parm::sr4(){
  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);
  
      rule_info__.parser__->set_use_all_shift_off();
      ADD_TOKEN_TO_ERROR_QUEUE(*sf->p2__);
      rule_info__.parser__->set_stop_parse(true);
    
}

