summaryrefslogtreecommitdiff
path: root/web/yacco2/grammar-testsuite/testout.cpp
blob: 142bc1d8ebcffd1ebfd21079dcfd63b2849b6304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*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*/