-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.py
More file actions
40 lines (30 loc) · 861 Bytes
/
token.py
File metadata and controls
40 lines (30 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from tag import Tag
class Token:
'''
Classe que representa um Token
'''
def __init__(self, nome, lexema, linha, coluna):
self.nome = nome
self.lexema = lexema
self.tipo = Tag.TIPO_VAZIO
self.linha = linha
self.coluna = coluna
def getNome(self):
return self.nome
def getLexema(self):
return self.lexema
def getLinha(self):
return self.linha
def setLinha(self, linha):
self.linha = linha
def getColuna(self):
return self.coluna
def setColuna(self, coluna):
self.coluna = coluna
def toString(self):
return ('<' + str(self.nome.name) + ', "' + str(self.lexema) + '"'
+ ', ' + str(self.tipo) + ', ' + str(self.linha) + ',' + str(self.coluna) + '>')
def getTipo(self):
return self.tipo
def setTipo(self, tipo):
self.tipo = tipo