executeCommands method
It takes a string of commands, validates them against the current schema, and then notifies the listeners
Args: commands (String): The commands to be executed.
Implementation
void executeCommands(String commands, String languageCode) {
final Pair<Results, CatError> results =
_interpreter.validateOnScheme(commands, SchemasReader().currentIndex);
if (results.second != CatError.none) {
final List<String> c = cat.splitCommands(commands);
if (c.first.startsWith("copy")) {
final List<String> c1 = cat.splitCommand(c.first);
for (String i in cat.splitByCurly(c1.last)) {
final String command = "copy(${c1.second},{$i})";
final Pair<Results, CatError> results = _interpreter.validateOnScheme(
command,
SchemasReader().currentIndex,
);
if (results.second == CatError.none) {
validCommandsBuffer.add(command);
}
}
}
_interpreter.reset();
for (final String i in validCommandsBuffer) {
_interpreter.validateOnScheme(i, SchemasReader().currentIndex);
}
} else {
validCommandsBuffer.add(commands);
}
notifyListeners();
}