-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpullpars.cpp
More file actions
executable file
·50 lines (50 loc) · 1.41 KB
/
pullpars.cpp
File metadata and controls
executable file
·50 lines (50 loc) · 1.41 KB
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
#include"all.hpp"
bool parserCls::isValidName(EtokenType et1 )
{bool bb1 = false ;
if( (et1 ==Name ) || (et1 == Array ) ) bb1= true ;
return bb1 ;
}
bool parserCls::pullArgStmt(void)
{bool bb1= true ;int i =0 ;
EtokenType et1 ;initExpr();
bool commaDetect = false ;
for(;;)
{ getToken(); et1 = getTokenType() ;
if( isValidName(et1) )
{ i++;ecs.push(getCurToken());}
else{bb1 =false;break ;}
getToken();et1 = getTokenType();
if( et1 == Comma )commaDetect = true;
else{commaDetect = false ; break ;}
}
if(bb1)
{ if(!( (et1 == Semicolon) || (et1 == EndOfLine ) ))
{bb1= false;errorPullArgParse(1);}
}
else if(commaDetect) errorPullArgParse(0);
else errorPullArgParse(2);
addExprToStmt(0);valInt[0]=i;noOfValInt=1;
return bb1 ;
}
bool parserCls::ArgStmtParse(void)
{bool bb1= true ;int i =0 ;
EtokenType et1 ;initExpr();
bool commaDetect = false ;
for(;;)
{ getToken(); et1 = getTokenType() ;
if( isValidName(et1) )
{ i++;ecs.push(getCurToken());}
else{bb1 =false;break ;}
getToken();et1 = getTokenType();
if( et1 == Comma )commaDetect = true;
else{commaDetect = false ; break ;}
}
if(bb1)
{ if(!( (et1 == Semicolon) || (et1 == EndOfLine ) ))
{bb1= false;errorPullArgParse(1);}
}
else if(commaDetect) errorPullArgParse(0);
else errorPullArgParse(2);
cpc->argList=getNewExprWithoutReverse();cpc->noOfArgList=i;
return bb1 ;
}