aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-11-25 16:43:05 -0600
committerIván Ávalos <avalos@disroot.org>2022-11-25 16:43:05 -0600
commite686a421a5c9841a779ed1d29cb6aacca5d7248b (patch)
treeede405b101e65bbcc322e226fdd41815b322428c
parentc7f014aef2c86d7a17f2642180732a6ba9b2a125 (diff)
downloadjavanol-e686a421a5c9841a779ed1d29cb6aacca5d7248b.tar.gz
javanol-e686a421a5c9841a779ed1d29cb6aacca5d7248b.tar.bz2
javanol-e686a421a5c9841a779ed1d29cb6aacca5d7248b.zip
Se arreglan paréntesis en expresiones
-rw-r--r--compilador/parse/expr.py2
-rw-r--r--pruebas/sintaxis2.es2
2 files changed, 2 insertions, 2 deletions
diff --git a/compilador/parse/expr.py b/compilador/parse/expr.py
index 492b4e6..cfbf89f 100644
--- a/compilador/parse/expr.py
+++ b/compilador/parse/expr.py
@@ -135,7 +135,6 @@ class ParseExpr:
elif tok.tipo == Token.READ:
return self.read_expr()
-
def postfix(self, lvalue: Optional[Expr]) -> (Expr | Error):
_lvalue: Optional[Expr] = lvalue
if not lvalue:
@@ -216,6 +215,7 @@ class ParseExpr:
rparen = self.parser.want(Token.R_PAREN)
if type(rparen) is Error:
return rparen
+ return expr
elif tok.tipo == Token.IDENT:
ident = ParseIdent(self.parser).ident()
if type(ident) is Error:
diff --git a/pruebas/sintaxis2.es b/pruebas/sintaxis2.es
index fdb9dd3..3319840 100644
--- a/pruebas/sintaxis2.es
+++ b/pruebas/sintaxis2.es
@@ -3,7 +3,7 @@ entero b = 20;
booleano c = verdadero;
caracter d;
funcion entero a (entero a, cadena b) {
- b = 40 + 2 * 10;
+ b = ((40 - 2) + 10) * 2;
imprimir ("Hola");
leer d;
};