add: arrays
This commit is contained in:
12
src/pasm.c
12
src/pasm.c
@@ -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], " "));
|
||||
|
||||
Reference in New Issue
Block a user