Commit 66a50bca authored by cwzsquare's avatar cwzsquare
Browse files

"逻辑表达式运算" Fixed

parent 8db9c823
......@@ -136,11 +136,11 @@ static int FoundRELOOP()
else if (tokenStr[0]=='>' && tokenStr[1]!='=') return(SYN_GT);
else if (tokenStr[0]=='>' && tokenStr[1]=='=') { prebuf=0; return(SYN_GE); }
else if (tokenStr[0]=='=' && tokenStr[1]!='=') return(SYN_SET);
else if (tokenStr[0]=='=' && tokenStr[1]=='=') return(SYN_EQ);
else if (tokenStr[0]=='=' && tokenStr[1]=='=') { prebuf=0; return(SYN_EQ); }
else if (tokenStr[0]=='!' && tokenStr[1]!='=') return(SYN_NOT);
else if (tokenStr[0]=='!' && tokenStr[1]=='=') return(SYN_NE);
else if (tokenStr[0]=='&' && tokenStr[1]=='&') return(SYN_AND);
else if (tokenStr[0]=='|' && tokenStr[1]=='|') return(SYN_OR);
else if (tokenStr[0]=='!' && tokenStr[1]=='=') { prebuf=0; return(SYN_NE); }
else if (tokenStr[0]=='&' && tokenStr[1]=='&') { prebuf=0; return(SYN_AND); }
else if (tokenStr[0]=='|' && tokenStr[1]=='|') { prebuf=0; return(SYN_OR); } //这个双目运算。。
else return(ERR);
}
......
......@@ -763,10 +763,12 @@ static EXPVAL Prod_F()
else if (lookahead.token==SYN_PAREN_L)
{
#if defined(AnaTypeSyn)
printf("SYN: F-->(B)\n");
printf("SYN: F-->(B)\n"); //这里莫不是给了提示
#endif
match(SYN_PAREN_L);
val=Prod_E();
val.type=ID_INT;
// val=Prod_E();
val.val.intval=Prod_B(); //修改文法`F-->(E)`为`F-->id | num | char | (B)`
match(SYN_PAREN_R);
}
else
......
No preview for this file type
main()
{ char ch;
ch='\\';
show(ch);
{ int a,b;
b=5;
a=(3*b>11)+(b>9||b<=6);
show(a);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment