diff options
Diffstat (limited to 'src/fype.c')
| -rw-r--r-- | src/fype.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -35,7 +35,10 @@ #include "fype.h" +#include <string.h> + #include "argv.h" +#include "core/token.h" #include "core/garbage.h" #include "core/interpret.h" #include "core/scanner.h" @@ -80,11 +83,24 @@ fype_run(int i_argc, char **pc_argv) { // argv: Maintains command line options argv_run(p_fype, i_argc, pc_argv); - // scanner: Creates a list of token - scanner_run(p_fype); + // scanner: Tokenise source into the token list + char *c_filename = NULL; + scanner_run(p_fype->p_list_token, p_fype->p_tupel_argv, &c_filename); + + // Verbose mode: print the token list after scanning + if (argv_checkopts("TV", p_fype->p_tupel_argv)) + list_iterate(p_fype->p_list_token, token_print_cb); + + // Derive the script basename (filename minus the .fy extension) + if (c_filename) { + int i_len = strlen(c_filename) - 3; + p_fype->c_basename = calloc(i_len + 1, sizeof(char)); + strncpy(p_fype->c_basename, c_filename, i_len); + p_fype->c_basename[i_len] = 0; + } // interpret: Interpret the list of token - interpret_run(p_fype); + interpret_run(p_fype->p_list_token, p_fype->p_hash_syms); fype_delete(p_fype); |
