aboutsummaryrefslogtreecommitdiff
path: root/compilador/parse/ident.py
blob: 5887fa22924d5e2b073ee8922e15596d772fcdc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from tabla import Token, LexToken
from parse.base import BaseParser
from astree.ident import Ident
from errors import Error

class ParseIdent:
    def __init__(self, parser: BaseParser):
        self.parser = parser

    def ident(self) -> (Ident | Error):
        tok: LexToken = self.parser.want(Token.IDENT)
        if type(tok) is Error:
            return tok
        return tok.nombre