aboutsummaryrefslogtreecommitdiff
path: root/compilador/errors.py
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-11-25 16:33:08 -0600
committerIván Ávalos <avalos@disroot.org>2022-11-25 16:33:08 -0600
commitc7f014aef2c86d7a17f2642180732a6ba9b2a125 (patch)
treed3439be25bf3ef025abb67144fc9c2fe1114530b /compilador/errors.py
parent43ca3b1370fcb9e7cb8c3126ebf4e6ed7833fc13 (diff)
downloadjavanol-c7f014aef2c86d7a17f2642180732a6ba9b2a125.tar.gz
javanol-c7f014aef2c86d7a17f2642180732a6ba9b2a125.tar.bz2
javanol-c7f014aef2c86d7a17f2642180732a6ba9b2a125.zip
¡Ya hay funciones y (algunas) expresiones!
Diffstat (limited to 'compilador/errors.py')
-rw-r--r--compilador/errors.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/compilador/errors.py b/compilador/errors.py
index 5a4e7a2..6bb05b8 100644
--- a/compilador/errors.py
+++ b/compilador/errors.py
@@ -15,8 +15,11 @@ class Error:
'S_ESPERA_PC': 'Se esperaba `;`',
}
- def __init__(self, msg: str = None):
- self.message = msg
+ def __init__(self, msg: str = None, numlinea: int = None):
+ if numlinea:
+ self.message = "Error en la línea %d: %s" % (numlinea, msg)
+ else:
+ self.message = msg
@classmethod
def lex(self, error, numlinea: int):