aboutsummaryrefslogtreecommitdiff
path: root/compilador/errors.py
diff options
context:
space:
mode:
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):