Skip to content

Commit be4b68e

Browse files
committed
[ADD] otros tokens
1 parent 7e11a57 commit be4b68e

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

compilador/src/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
def main():
44
ft.app(v.vista)
55

6-
7-
86
if __name__ == "__main__":
97
main()

compilador/src/services/analizador_lexico/lexico.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"COMA",
2121
"PUNTO",
2222
"ASIGNACION",
23+
"MAYOR_IGUAL_QUE",
2324
"MAYOR_QUE",
25+
"MENOR_IGUAL_QUE",
2426
"MENOR_QUE",
2527
"IGUALDAD",
2628
"MAYOR_O_IGUAL_QUE",
@@ -36,6 +38,9 @@
3638
"MODIFICADOR",
3739
"TIPO_FUNCION",
3840
"PALABRA_RESERVADA",
41+
"DOS_PUNTOS",
42+
"COMENTARIO",
43+
"BLOQUE_COMENTARIO"
3944
)
4045

4146
palabrasReservadas = {
@@ -71,14 +76,24 @@
7176
"long": "TIPO_DATO",
7277
"short": "TIPO_DATO",
7378
"return": "PALABRA_RESERVADA",
79+
"final":"PALABRA_RESERVADA"
7480
}
7581

82+
def t_COMENTARIO(t):
83+
r'\//.*'
84+
return t
85+
86+
def t_BLOQUE_COMENTARIO(t):
87+
r'\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/'
88+
return t
89+
7690
def t_IDENTIFICADOR(t):
7791
r'[a-zA-Z_][a-zA-Z0-9_]*'
7892
if t.value in palabrasReservadas:
7993
t.type = palabrasReservadas[t.value]
8094
return t
8195

96+
8297
def t_NUMERO_ENTERO(t):
8398
r'\d+'
8499
t.value = int(t.value)
@@ -164,6 +179,9 @@ def t_PUNTO_COMA(t):
164179
def t_COMA(t):
165180
r'\,'
166181
return t
182+
def t_DOS_PUNTOS(t):
183+
r'\:'
184+
return t
167185

168186
def t_PUNTO(t):
169187
r'\.'
@@ -172,15 +190,18 @@ def t_PUNTO(t):
172190
def t_ASIGNACION(t):
173191
r'\='
174192
return t
175-
193+
def t_MAYOR_IGUA_QUE(t):
194+
r'\>\='
195+
return t
176196
def t_MAYOR_QUE(t):
177197
r'\>'
178198
return t
179-
199+
def t_MENOR_IGUAL_QUE(t):
200+
r'\<\='
201+
return t
180202
def t_MENOR_QUE(t):
181203
r'\<'
182204
return t
183-
184205
def t_IGUALDAD(t):
185206
r'\=='
186207
return t
Binary file not shown.

compilador/src/view/vista_principal.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import flet as ft
2-
import os
32
import services.lectura_fichero as lf
43
import services.analizador_lexico.lexico as al
54

0 commit comments

Comments
 (0)