/*
 File: esc_seq.cpp
 Date and Time: Fri Jan 30 18:55:11 2015 
*/
#include "esc_seq.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_esc_seq;// grammar's ns
// first set terminals
fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){
 no_rules_entries_ = 17;
 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();
 per_rule_s_table_[16] =  new Per_rule_s_reuse_table();
}
  Cesc_seq::
  Cesc_seq()
    :yacco2::CAbs_fsm
      ("esc_seq.lex"
      ,"1.0"
      ,"25 Juin 2003"
      ,false
      ,"C type escape sequence recognizer."
      ,"Fri Jan 30 18:55:11 2015 "
      ,S1_Cesc_seq){
    
  }
 
Cesc_seq::~Cesc_seq(){

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

  bool Cesc_seq::failed(){
      return false;
  }
  void Cesc_seq::op(){
    parser__->set_use_all_shift_on();
    data_.clear();
  
}
int Cesc_seq::rhs_to_rules_mapping_[65] = {
 -1
 ,0 // subrule 1 for rule 1
 ,0 // subrule 2 for rule 1
 ,0 // subrule 3 for rule 1
 ,0 // subrule 4 for rule 1
 ,0 // subrule 5 for rule 1
 ,1 // subrule 6 for rule 2
 ,2 // subrule 7 for rule 3
 ,2 // subrule 8 for rule 3
 ,2 // subrule 9 for rule 3
 ,2 // subrule 10 for rule 3
 ,2 // subrule 11 for rule 3
 ,2 // subrule 12 for rule 3
 ,2 // subrule 13 for rule 3
 ,2 // subrule 14 for rule 3
 ,2 // subrule 15 for rule 3
 ,2 // subrule 16 for rule 3
 ,2 // subrule 17 for rule 3
 ,2 // subrule 18 for rule 3
 ,3 // subrule 19 for rule 4
 ,4 // subrule 20 for rule 5
 ,5 // subrule 21 for rule 6
 ,6 // subrule 22 for rule 7
 ,7 // subrule 23 for rule 8
 ,8 // subrule 24 for rule 9
 ,8 // subrule 25 for rule 9
 ,9 // subrule 26 for rule 10
 ,10 // subrule 27 for rule 11
 ,11 // subrule 28 for rule 12
 ,11 // subrule 29 for rule 12
 ,12 // subrule 30 for rule 13
 ,12 // subrule 31 for rule 13
 ,13 // subrule 32 for rule 14
 ,13 // subrule 33 for rule 14
 ,13 // subrule 34 for rule 14
 ,13 // subrule 35 for rule 14
 ,13 // subrule 36 for rule 14
 ,13 // subrule 37 for rule 14
 ,13 // subrule 38 for rule 14
 ,13 // subrule 39 for rule 14
 ,13 // subrule 40 for rule 14
 ,13 // subrule 41 for rule 14
 ,14 // subrule 42 for rule 15
 ,14 // subrule 43 for rule 15
 ,14 // subrule 44 for rule 15
 ,14 // subrule 45 for rule 15
 ,14 // subrule 46 for rule 15
 ,14 // subrule 47 for rule 15
 ,14 // subrule 48 for rule 15
 ,14 // subrule 49 for rule 15
 ,14 // subrule 50 for rule 15
 ,14 // subrule 51 for rule 15
 ,14 // subrule 52 for rule 15
 ,14 // subrule 53 for rule 15
 ,15 // subrule 54 for rule 16
 ,15 // subrule 55 for rule 16
 ,15 // subrule 56 for rule 16
 ,16 // subrule 57 for rule 17
 ,16 // subrule 58 for rule 17
 ,16 // subrule 59 for rule 17
 ,16 // subrule 60 for rule 17
 ,16 // subrule 61 for rule 17
 ,16 // subrule 62 for rule 17
 ,16 // subrule 63 for rule 17
 ,16 // subrule 64 for rule 17
}; 

    yacco2::CAbs_lr1_sym* Cesc_seq::chk_for_overrun(){
	  switch (parser__->current_token()->enumerated_id__){
	  case T_Enum::T_raw_lf_: break;
	  case T_Enum::T_raw_cr_: break;
	  case T_Enum::T_T_eol_: break;
	  case T_Enum::T_LR1_eog_: break;
      default: return 0;		
      }
      CAbs_lr1_sym* sym = new Err_bad_eos;
      sym->set_rc(*parser__->start_token__,__FILE__,__LINE__);
      parser__->set_use_all_shift_off();
      return sym;
    }
  
Resc_seq::Resc_seq(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Resc_seq",0,Cesc_seq::R_Resc_seq_,P,false,false){
}

void Resc_seq::op(){
  sstrace_rulesss
 
    Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
    CAbs_lr1_sym* sym = new T_esc_seq(fsm->data_.c_str());
    sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
    sym->set_line_no_and_pos_in_line(*rule_info__.parser__->start_token__);
    RSVP(sym);
  
}
void Resc_seq::sr2(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
	  fsm->data_ += '\\';
	  fsm->data_ += fsm->octal_data_.c_str();
    
}

void Resc_seq::sr3(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
	  fsm->data_ += fsm->hex_data_.c_str();
    
}

Rslash::Rslash(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rslash",0,Cesc_seq::R_Rslash_,P,false,false){
}

void Rslash::sr1(){
  		
      Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      CAbs_lr1_sym* sym = fsm->chk_for_overrun();
      if(sym == 0) return;
      RSVP(sym);
      rule_info__.parser__->set_stop_parse(true);
    
}

Rliteral::Rliteral(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rliteral",0,Cesc_seq::R_Rliteral_,P,false,false){
}

void Rliteral::sr1(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_ += 'n';
    
}

void Rliteral::sr2(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='t';
    
}

void Rliteral::sr3(){
  		
        Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='v';
    
}

void Rliteral::sr4(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='b';
    
}

void Rliteral::sr5(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='r';
    
}

void Rliteral::sr6(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='f';
    
}

void Rliteral::sr7(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='a';
    
}

void Rliteral::sr8(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+="\\";
    
}

void Rliteral::sr9(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='?';
    
}

void Rliteral::sr10(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+="'";
    
}

void Rliteral::sr11(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+='"';
    
}

void Rliteral::sr12(){
  		
      CAbs_lr1_sym* sym = new Err_bad_esc;
      sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
       sym->set_line_no_and_pos_in_line(*rule_info__.parser__->start_token__);
      RSVP(sym);
      rule_info__.parser__->set_stop_parse(true);
    
}

Ruhex::Ruhex(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Ruhex",0,Cesc_seq::R_Ruhex_,P,false,false){
}

Ru::Ru(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Ru",0,Cesc_seq::R_Ru_,P,false,false){
}

void Ru::sr1(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+= 'u';
    
}

RU::RU(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("RU",0,Cesc_seq::R_RU_,P,false,false){
}

void RU::sr1(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+= 'U';
    
}

Rx::Rx(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rx",0,Cesc_seq::R_Rx_,P,false,false){
}

void Rx::sr1(){
  		
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      fsm->data_ += "\\";
      fsm->data_+= 'x';
    
}

RUhex::RUhex(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("RUhex",0,Cesc_seq::R_RUhex_,P,false,false){
}

Rmhex_no::Rmhex_no(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rmhex_no",0,Cesc_seq::R_Rmhex_no_,P,false,false){
}

void Rmhex_no::sr2(){
  		
      CAbs_lr1_sym* sym = new Err_bad_esc;
      sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
      RSVP(sym);
      rule_info__.parser__->set_stop_parse(true);
    
}

Rcalc_hex_char::Rcalc_hex_char(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rcalc_hex_char",0,Cesc_seq::R_Rcalc_hex_char_,P,false,false){
}

void Rcalc_hex_char::sr1(){
  
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
	  unsigned long usl = strtoul(fsm->hex_data_.c_str(),0,16);
	  unsigned char c = usl;
      fsm->data_ += "\\x";
	  fsm->data_ += c;
	  fsm->hex_data_.clear();
	
}

Rhex::Rhex(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rhex",0,Cesc_seq::R_Rhex_,P,false,false){
}

Rhex_nos::Rhex_nos(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rhex_nos",0,Cesc_seq::R_Rhex_nos_,P,false,false){
}

Rhex_no::Rhex_no(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rhex_no",0,Cesc_seq::R_Rhex_no_,P,false,false){
}

Rhex_no_digit::Rhex_no_digit(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rhex_no_digit",0,Cesc_seq::R_Rhex_no_digit_,P,false,false){
}

void Rhex_no_digit::op(){
  sstrace_rulesss
 
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      size_t pos = rule_info__.parser__->parse_stack__.top_sub__ - 1;
      CAbs_lr1_sym* sym = rule_info__.parser__->get_spec_stack_token(pos);
	  fsm->hex_data_ += sym->id__;
    
}
Rhex_no_letter::Rhex_no_letter(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rhex_no_letter",0,Cesc_seq::R_Rhex_no_letter_,P,false,false){
}

void Rhex_no_letter::op(){
  sstrace_rulesss
 
      Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      size_t pos = rule_info__.parser__->parse_stack__.top_sub__ - 1;
      CAbs_lr1_sym* sym = rule_info__.parser__->get_spec_stack_token(pos);
	  fsm->hex_data_ += sym->id__;
    
}
Roctal::Roctal(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Roctal",0,Cesc_seq::R_Roctal_,P,false,false){
}

Roctal_no::Roctal_no(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Roctal_no",0,Cesc_seq::R_Roctal_no_,P,false,false){
}

void Roctal_no::op(){
  sstrace_rulesss
 
	  Cesc_seq* fsm = (Cesc_seq*) rule_info__.parser__->fsm_tbl__;
      size_t pos = rule_info__.parser__->parse_stack__.top_sub__ - 1;
      CAbs_lr1_sym* sym = rule_info__.parser__->get_spec_stack_token(pos);
	  fsm->octal_data_ += sym->id__;
    
}
