-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToken.py
35 lines (27 loc) · 1015 Bytes
/
Token.py
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
# Universidad Nacional de Costa Rica
# II Proyecto de Estructuras de Datos
# Analizador Semántico
# Profesor: José Calvo Suárez
# Autores Dayana Gibellato y Gianluca Gibellato
class Token(object):
def __init__(self, type='', name='', scope=0, line=0, function=False):
self._type = type
self._name = name
self._scope = scope
self._line = line
self._isFunction = function # True if the token is a function, False otherwise
def set_type(self, type):
self._type = type
def set_name(self, name):
self._name = name
def set_scope(self, scope):
self._scope = scope
def get_type(self):
return self._type
def get_name(self):
return self._name
def get_scope(self):
return self._scope
def __str__(self):
return ('Type: ' + self._type + ', Name: ' + self._name + ', Scope: ' +
str(self._scope) + ', Line: ' + str(self._line)) + ', Function: ' + str(self._isFunction)