add: arrays

This commit is contained in:
2024-01-22 22:24:40 +01:00
parent 827937e4dc
commit 4bcb50865c
9 changed files with 228 additions and 6 deletions

View File

@@ -105,12 +105,22 @@ int pasm_run_script(const char *filename, char **file, size_t lines, int _fstrea
#else
char *line = strdup(file[state->curr_line]);
#endif
if (line[0] == ';' || line[0] == '\0') {
if (line[0] == ';' || line[0] == '\0' || line[0] == '\t') {
free(line);
continue;
}
const command_t *com = find_command(command_map, strtok(line, " "));
if (com == NULL || com->fptr == NULL) {
ARRAY_ERR err = add_array(file[state->curr_line]);
if (err == ARRAY_OK)
continue;
if (err == ARRAY_ERROR) {
show_error(state->curr_line, file[state->curr_line]);
dprintf(fstream, "%s\n", "bad syntax in array definition");
set_exit_state(-1);
free(line);
break;
}
if (file[state->curr_line][strlen(line) - 1] != ':') {
show_error(state->curr_line, file[state->curr_line]);
dprintf(fstream, "%s \"%s\"\n", "unknown expression", strtok(file[state->curr_line], " "));