/*14:*/
#line 212 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

/*2:*/
#line 54 "/usr/local//yacco2/grammar-testsuite/testout_comments.w"

/*3:*/
#line 11 "/usr/local//yacco2/grammar-testsuite/testout_includes.w"

#include "testout.h"

/*:3*/
#line 55 "/usr/local//yacco2/grammar-testsuite/testout_comments.w"
;

#line 1 "/usr/local//yacco2/grammar-testsuite/testout_includes.w"







/*:2*//*5:*/
#line 13 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

#define Max_buf_size 2*1024
std::string Holding_file("testout_holding_file.cmd");
std::string To_parse_file;

YACCO2_define_trace_variables();
yacco2::TOKEN_GAGGLE JUNK_tokens;
yacco2::TOKEN_GAGGLE IP_tokens;
yacco2::TOKEN_GAGGLE Error_queue;

/*:5*//*7:*/
#line 64 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

void GET_CMD_LINE(int argc,char*argv[]
,const char*Holding
,std::string&File_to_parse
,yacco2::TOKEN_GAGGLE&Errors)
{
using namespace std;
using namespace NS_testout_err_symbols;
using namespace yacco2;
ofstream ofile;
ofile.open(Holding,ios_base::out|ios::trunc);
if(!ofile){
CAbs_lr1_sym*sym= new Err_bad_filename(Holding);
sym->set_external_file_id(1);
sym->set_line_no(1);
sym->set_pos_in_line(1);
Errors.push_back(*sym);
return;
}
if(argc==1){
char cmd_line[Max_buf_size];
cout<<"Please enter Command line to process: ";
cin.get(cmd_line,Max_buf_size,'\n');
ofile<<cmd_line;
File_to_parse+= cmd_line;
ofile.close();
}else{
for(int x= 1;x<argc;++x){
ofile<<argv[x];
File_to_parse+= argv[x];
}
ofile.close();
}
tok_can<std::ifstream> Cmd1_tokens(Holding);
ifstream ifile;
ifile.open(File_to_parse.c_str());
if(!ifile){
CAbs_lr1_sym*sym= new Err_bad_filename(File_to_parse.c_str());
sym->set_external_file_id(1);
sym->set_line_no(1);
sym->set_pos_in_line(1);
Errors.push_back(*sym);
return;
}
ifile.close();
return;
}
/*:7*//*8:*/
#line 114 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

void DUMP_ERROR_QUEUE(yacco2::TOKEN_GAGGLE&Errors)
{
using namespace NS_yacco2_k_symbols;
using namespace yacco2;
Errors.push_back(*yacco2::PTR_LR1_eog__);
Errors.push_back(*yacco2::PTR_LR1_eog__);
using namespace NS_testout_err_hdlr;

Ctestout_err_hdlr fsm;
Parser pass_errors(fsm,&Errors,0);
pass_errors.parse();
yacco2::Parallel_threads_shutdown(pass_errors);
}

/*:8*//*9:*/
#line 148 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

int main(int argc,char*argv[])
{
std::cout<<"testout start"<<std::endl;
using namespace yacco2;
/*11:*/
#line 184 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

yacco2::YACCO2_T__= 1;
yacco2::YACCO2_TH__= 1;
yacco2::YACCO2_MSG__= 1;


/*:11*/
#line 153 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"
;
/*12:*/
#line 191 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

GET_CMD_LINE(argc,argv,Holding_file.c_str(),To_parse_file,Error_queue);
/*13:*/
#line 202 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}


/*:13*/
#line 193 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"
;


/*:12*/
#line 154 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"
;
using namespace NS_pager_1;
tok_can<std::ifstream> cmd_line(To_parse_file.c_str());
Cpager_1 pager_1_fsm;
Parser testout_parse(pager_1_fsm,&cmd_line,&IP_tokens,0,&Error_queue,&JUNK_tokens,0);
if(testout_parse.parse()==Parser::erred){
std::cout<<"===============>ERROR OCCURRED"<<std::endl;
/*13:*/
#line 202 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}


/*:13*/
#line 161 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"
;
}

exit:
std::cout<<"Exiting testout"<<std::endl;
return 0;
}

/*:9*/
#line 213 "/usr/local//yacco2/grammar-testsuite/testout_prog.w"
;

#line 15 "./testout.w"
/*:14*/
