Added cexpr

master
Sanjar Ahmadov 3 years ago
parent 7b2e1dab3f
commit 1c02aa84d8

@ -403,7 +403,7 @@ literal ::= NONE:n {: RESULT = new NoneLi
/* expr */
expr ::= pexpr:ce {: RESULT = ce; :}
expr ::= cexpr:ce {: RESULT = ce; :}
| NOT:n expr:exp {: RESULT = new UnaryExpr(nxleft, expxright, n, exp); :}
| expr:e1 AND:a expr:e2 {: RESULT = new BinaryExpr(e1xleft, e2xright, e1, a, e2); :}
| expr:e1 OR:o expr:e2 {: RESULT = new BinaryExpr(e1xleft, e2xright, e1, o, e2); :}
@ -412,16 +412,11 @@ expr ::= pexpr:ce {: RESULT = ce; :}
/* cexpr */
/*
cexpr ::= pexpr:pe {: RESULT = new Expr(pexleft, pexright); :}
| cmp_pexpr:cp {: RESULT = new Expr(cpxleft, cpxright); :}
cexpr ::= pexpr:pe {: RESULT = pe; :}
| pexpr:p1 comp_op:co cexpr:p2 {: RESULT = new BinaryExpr(p1xleft, p2xright, p1, co.value, p2); :}
;
cmp_pexpr ::= pexpr:p comp_op:co cmp_pexpr:p2 {: RESULT = new BinaryExpr(p1xleft, p2xright, p1, co, p2); :}
| pexpr:p {: RESULT = new Expr(pxleft, pxright); :}
;
*/
/* pexpr */
pexpr ::= identifier:id {: RESULT = id; :}
@ -434,7 +429,6 @@ pexpr ::= identifier:id {: RESULT = id; :}
| identifier:id LPAR expr_list:l RPAR:rpar {: RESULT = new CallExpr(idxleft, rparxright, id, l); :}
| pexpr:p1 bin_op:bo pexpr:p2 {: RESULT = new BinaryExpr(p1xleft, p2xright, p1, bo.value, p2); :}
| MINUS:m pexpr:p {: RESULT = new UnaryExpr(mxleft, pxright, m, p); :}
| pexpr:p1 comp_op:co pexpr:p2 {: RESULT = new BinaryExpr(p1xleft, p2xright, p1, co.value, p2); :}
;
expr_list ::= expr:e {: RESULT = single(e); :}

Loading…
Cancel
Save