/*
 File: int_no.cpp
 Date and Time: Fri Jan 30 18:55:13 2015 
*/
#include "int_no.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_int_no;// grammar's ns
// first set terminals
fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){
 no_rules_entries_ = 3;
 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();
}
  Cint_no::
  Cint_no()
    :yacco2::CAbs_fsm
      ("int_no.lex"
      ,"1.0"
      ,"3 mar 2003"
      ,false
      ,"Integer number lexer."
      ,"Fri Jan 30 18:55:13 2015 "
      ,S1_Cint_no){
    
    ddd_idx_ = 0;
    ddd_[ddd_idx_] = 0;
 
  }
 
Cint_no::~Cint_no(){

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

  bool Cint_no::failed(){
      return false;
  }
  void Cint_no::op(){
    ddd_idx_ = 0;
    ddd_[ddd_idx_] = 0;
  
}
int Cint_no::rhs_to_rules_mapping_[14] = {
 -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
 ,2 // subrule 6 for rule 3
 ,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
}; 
Rint_no::Rint_no(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rint_no",0,Cint_no::R_Rint_no_,P,false,false){
}

void Rint_no::sr1(){
  
	Cint_no* fsm = (Cint_no*)rule_info__.parser__->fsm_tbl__;
	long lno = strtol(fsm->ddd_,0,10);
 if (errno == ERANGE){
	  Err_bad_int_no* sym = new Err_bad_int_no;
	  sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
	  RSVP(sym);
	}else{
	  T_int_no* sym = new T_int_no(lno);
	  sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
	  RSVP(sym);
	}
    
}

Rdec_no::Rdec_no(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rdec_no",0,Cint_no::R_Rdec_no_,P,false,false){
}

Rdigit::Rdigit(yacco2::Parser* P)
 :CAbs_lr1_sym
  ("Rdigit",0,Cint_no::R_Rdigit_,P,false,false){
}

void Rdigit::op(){
  sstrace_rulesss
 
    Cint_no* fsm = (Cint_no*)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->ddd_[fsm->ddd_idx_] = sym->id__[0];
    ++fsm->ddd_idx_;
    fsm->ddd_[fsm->ddd_idx_] = 0;
  
}
