diff options
Diffstat (limited to 'compilador/errors.py')
-rw-r--r-- | compilador/errors.py | 7 |
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): |