aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-11-25 16:45:10 -0600
committerIván Ávalos <avalos@disroot.org>2022-11-25 16:45:10 -0600
commit4b78bc397a51456bd9d0bf08fbd6b1394b91c288 (patch)
tree66889382c9109536af06eb81e45322eae656bc30
parente686a421a5c9841a779ed1d29cb6aacca5d7248b (diff)
downloadjavanol-4b78bc397a51456bd9d0bf08fbd6b1394b91c288.tar.gz
javanol-4b78bc397a51456bd9d0bf08fbd6b1394b91c288.tar.bz2
javanol-4b78bc397a51456bd9d0bf08fbd6b1394b91c288.zip
Se arreglan llamadas a funciones
-rw-r--r--compilador/parse/expr.py8
-rw-r--r--pruebas/sintaxis2.es2
2 files changed, 4 insertions, 6 deletions
diff --git a/compilador/parse/expr.py b/compilador/parse/expr.py
index cfbf89f..806fb8d 100644
--- a/compilador/parse/expr.py
+++ b/compilador/parse/expr.py
@@ -34,16 +34,13 @@ class ParseExpr:
# WIP
def binarithm(self, lvalue: Expr, i: int) -> (Expr | Error):
- print(f'binarithm({lvalue}, {i})')
_lvalue = lvalue
if not lvalue:
_lvalue = self.cast(lvalue)
if type(_lvalue) is Error:
return _lvalue
- print(f'lvalue = {_lvalue}')
tok = self.parser.lex()
- print(f'tok = {tok}')
j: int = self.precedence(tok.tipo)
while j >= i:
op = self.binop_for_tok(tok.tipo)
@@ -106,7 +103,8 @@ class ParseExpr:
# }
item = self.parser.peek(Token.R_BRACKET)
if item: break
-
+
+ # Expresión
item = self.expr()
if type(item) is Error:
return item
@@ -147,7 +145,7 @@ class ParseExpr:
return _lvalue
_next: Optional[LexToken] = None
- if tok == Token.L_PAREN:
+ if tok.tipo == Token.L_PAREN:
return self.call(_lvalue)
return self.postfix(_next)
diff --git a/pruebas/sintaxis2.es b/pruebas/sintaxis2.es
index 3319840..d1c49f9 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) * 2;
+ b = ((40 - 2) + 10) * 2 + b(10);
imprimir ("Hola");
leer d;
};