Ethgoin commited on
Commit
6e9ef00
verified
1 Parent(s): f9ada29

Update semantico.py

Browse files
Files changed (1) hide show
  1. semantico.py +23 -17
semantico.py CHANGED
@@ -70,22 +70,28 @@ class AnalizadorSemantico:
70
  return "error"
71
 
72
  def validar_funcion(self, nombre, arg):
73
- funciones_sin_argumento = {
74
- "START", "REBOOT", "SHUTDOWN"
75
- }
76
- funciones_con_argumento = {
77
- "MOVE_FORWARD", "MOVE_BACKWARD", "PRINT", "SET",
78
- "TOGGLE_LIGHT", "CALIBRATE", "ROTATE", "WAIT",
79
- "TURN_LEFT", "TURN_RIGHT", "ACTIVATE_SENSOR", "DEACTIVATE_SENSOR"
80
- }
81
 
82
- if nombre in funciones_sin_argumento:
83
- if arg is not None:
84
- self.errores.append(f"La funci贸n '{nombre}' no debe tener argumentos.")
85
- elif nombre in funciones_con_argumento:
86
- if arg is None:
87
- self.errores.append(f"La funci贸n '{nombre}' requiere un argumento.")
88
- else:
89
- self.analizar_expresion(arg)
 
 
 
 
90
  else:
91
- self.errores.append(f"Funci贸n '{nombre}' no reconocida.")
 
 
 
70
  return "error"
71
 
72
  def validar_funcion(self, nombre, arg):
73
+ funciones_sin_argumento = {
74
+ "ACTIVATE_ALARM", "ACTIVATE_SENSOR", "BREAK", "CHARGE_BATTERY", "CHECK_BATTERY",
75
+ "CLOSE_DOOR", "CONTINUE", "DEACTIVATE_ALARM", "DEACTIVATE_SENSOR", "DECREASE_SPEED",
76
+ "DOWNLOAD", "REBOOT", "READ_SENSOR", "RESET", "RESUME", "REVERSE", "SHUTDOWN",
77
+ "SHUT_OFF", "START", "STOP", "STOP_IMMEDIATELY", "TOGGLE_LIGHT", "TURN_DOWN",
78
+ "TURN_LEFT", "TURN_RIGHT", "TURN_UP", "UNLOCK", "LOG", "INIT", "LOCK", "LOW_BATTERY",
79
+ "OPEN_DOOR", "PAUSE"
80
+ }
81
 
82
+ funciones_con_argumento = {
83
+ "CALIBRATE", "COPY_FILE", "DELETE_FILE", "MOVE_BACKWARD", "MOVE_FORWARD", "MOVE_TO",
84
+ "PRINT", "RENAME_FILE", "ROTATE", "SAVE_FILE", "SCAN", "SET", "SET_SPEED", "UPLOAD",
85
+ "UPLOAD_FILE", "WAIT"
86
+ }
87
+
88
+ if nombre in funciones_sin_argumento:
89
+ if arg is not None:
90
+ self.errores.append(f"La funci贸n '{nombre}' no debe tener argumentos.")
91
+ elif nombre in funciones_con_argumento:
92
+ if arg is None:
93
+ self.errores.append(f"La funci贸n '{nombre}' requiere un argumento.")
94
  else:
95
+ self.analizar_expresion(arg)
96
+ else:
97
+ self.errores.append(f"Funci贸n '{nombre}' no reconocida.")