|
ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
|
#include <stdio.h>#include <string.h>#include <errno.h>#include <stdlib.h>#include "ugbc.tab.h"#include <unistd.h>Go to the source code of this file.
Data Structures | |
| struct | yy_buffer_state |
| struct | yy_trans_info |
Macros | |
| #define | YY_INT_ALIGNED short int |
| #define | FLEX_SCANNER |
| #define | YY_FLEX_MAJOR_VERSION 2 |
| #define | YY_FLEX_MINOR_VERSION 6 |
| #define | YY_FLEX_SUBMINOR_VERSION 4 |
| #define | FLEX_BETA |
| #define | FLEXINT_H |
| #define | INT8_MIN (-128) |
| #define | INT16_MIN (-32767-1) |
| #define | INT32_MIN (-2147483647-1) |
| #define | INT8_MAX (127) |
| #define | INT16_MAX (32767) |
| #define | INT32_MAX (2147483647) |
| #define | UINT8_MAX (255U) |
| #define | UINT16_MAX (65535U) |
| #define | UINT32_MAX (4294967295U) |
| #define | SIZE_MAX (~(size_t)0) |
| #define | yyconst const |
| #define | yynoreturn |
| #define | YY_NULL 0 |
| #define | YY_SC_TO_UI(c) |
| #define | BEGIN (yy_start) = 1 + 2 * |
| #define | YY_START (((yy_start) - 1) / 2) |
| #define | YYSTATE YY_START |
| #define | YY_STATE_EOF(state) |
| #define | YY_NEW_FILE yyrestart( yyin ) |
| #define | YY_END_OF_BUFFER_CHAR 0 |
| #define | YY_BUF_SIZE 16384 |
| #define | YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
| #define | YY_TYPEDEF_YY_BUFFER_STATE |
| #define | YY_TYPEDEF_YY_SIZE_T |
| #define | EOB_ACT_CONTINUE_SCAN 0 |
| #define | EOB_ACT_END_OF_FILE 1 |
| #define | EOB_ACT_LAST_MATCH 2 |
| #define | YY_LESS_LINENO(n) |
| #define | YY_LINENO_REWIND_TO(dst) |
| #define | yyless(n) |
| #define | unput(c) |
| #define | YY_STRUCT_YY_BUFFER_STATE |
| #define | YY_BUFFER_NEW 0 |
| #define | YY_BUFFER_NORMAL 1 |
| #define | YY_BUFFER_EOF_PENDING 2 |
| #define | YY_CURRENT_BUFFER |
| #define | YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] |
| #define | YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) |
| #define | yy_new_buffer yy_create_buffer |
| #define | yy_set_interactive(is_interactive) |
| #define | yy_set_bol(at_bol) |
| #define | YY_AT_BOL() |
| #define | yytext_ptr yytext |
| #define | YY_DO_BEFORE_ACTION |
| #define | YY_NUM_RULES 1594 |
| #define | YY_END_OF_BUFFER 1595 |
| #define | REJECT reject_used_but_not_detected |
| #define | yymore() |
| #define | YY_MORE_ADJ 0 |
| #define | YY_RESTORE_YY_MORE_OFFSET |
| #define | RETURN(b, c) |
| #define | INITIAL 0 |
| #define | incl 1 |
| #define | impt 2 |
| #define | asm 3 |
| #define | YY_EXTRA_TYPE void * |
| #define | YY_READ_BUF_SIZE 8192 |
| #define | ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) |
| #define | YY_INPUT(buf, result, max_size) |
| #define | yyterminate() |
| #define | YY_START_STACK_INCR 25 |
| #define | YY_FATAL_ERROR(msg) |
| #define | YY_DECL_IS_OURS 1 |
| #define | YY_DECL int yylex (void) |
| #define | YY_USER_ACTION |
| #define | YY_BREAK /*LINTED*/break; |
| #define | YY_RULE_SETUP YY_USER_ACTION |
| #define | YY_EXIT_FAILURE 2 |
| #define | yyless(n) |
| #define | YYTABLES_NAME "yytables" |
Typedefs | |
| typedef struct yy_buffer_state * | YY_BUFFER_STATE |
Functions | |
| void | yyrestart (FILE *input_file) |
| void | yy_switch_to_buffer (YY_BUFFER_STATE new_buffer) |
| YY_BUFFER_STATE | yy_create_buffer (FILE *file, int size) |
| void | yy_delete_buffer (YY_BUFFER_STATE b) |
| void | yy_flush_buffer (YY_BUFFER_STATE b) |
| void | yypush_buffer_state (YY_BUFFER_STATE new_buffer) |
| void | yypop_buffer_state (void) |
| YY_BUFFER_STATE | yy_scan_buffer (char *base, yy_size_t size) |
| YY_BUFFER_STATE | yy_scan_string (const char *yy_str) |
| YY_BUFFER_STATE | yy_scan_bytes (const char *bytes, int len) |
| void * | yyalloc (yy_size_t) |
| void * | yyrealloc (void *, yy_size_t) |
| void | yyfree (void *) |
| char * | import_file_name (char *_import_path) |
| char * | strcopy (char *_dest, char *_source) |
| char * | strreplace (const char *_orig, const char *_rep, const char *_with) |
| int | yylex_destroy (void) |
| int | yyget_debug (void) |
| void | yyset_debug (int debug_flag) |
| YY_EXTRA_TYPE | yyget_extra (void) |
| void | yyset_extra (YY_EXTRA_TYPE user_defined) |
| FILE * | yyget_in (void) |
| void | yyset_in (FILE *_in_str) |
| FILE * | yyget_out (void) |
| void | yyset_out (FILE *_out_str) |
| int | yyget_leng (void) |
| char * | yyget_text (void) |
| int | yyget_lineno (void) |
| void | yyset_lineno (int _line_number) |
| int | yywrap (void) |
| int | yylex (void) |
| if (!(yy_init)) | |
Variables | |
| int | yyleng |
| FILE * | yyin = NULL |
| FILE * | yyout = NULL |
| int | yylineno = 1 |
| char * | yytext |
| int | yy_flex_debug = 0 |
| int | yyconcatlineno |
| int | yycolno |
| int | yyposno |
| char * | filenamestacked [256] |
| int | yylinenostacked [] |
| int | yycolnostacked [] |
| int | yyposnostacked [] |
| int | stacked |
| char * | asmSnippet |
| char * | importPath |
| char | targetName [] |
| YY_DECL | |
| char * | yy_cp |
| char * | yy_bp |
| int | yy_act |
| #define RETURN | ( | b, | |
| c ) |
| #define unput | ( | c | ) |
| #define YY_AT_BOL | ( | ) |
| #define YY_CURRENT_BUFFER |
| #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] |
| #define YY_DO_BEFORE_ACTION |
| #define YY_EXIT_FAILURE 2 |
| #define YY_FATAL_ERROR | ( | msg | ) |
| #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) |
| #define YY_INPUT | ( | buf, | |
| result, | |||
| max_size ) |
| #define YY_LESS_LINENO | ( | n | ) |
| #define YY_LINENO_REWIND_TO | ( | dst | ) |
| #define yy_new_buffer yy_create_buffer |
| #define YY_RULE_SETUP YY_USER_ACTION |
| #define YY_SC_TO_UI | ( | c | ) |
| #define yy_set_bol | ( | at_bol | ) |
| #define yy_set_interactive | ( | is_interactive | ) |
| #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
| #define YY_STATE_EOF | ( | state | ) |
| #define yyless | ( | n | ) |
| #define yyless | ( | n | ) |
| #define YYTABLES_NAME "yytables" |
| #define yyterminate | ( | ) |
| typedef struct yy_buffer_state* YY_BUFFER_STATE |
| char * import_file_name | ( | char * | _import_path | ) |
Definition at line 17204 of file _infrastructure.c.
| char * strcopy | ( | char * | _dest, |
| char * | _source ) |
Definition at line 17121 of file _infrastructure.c.
| char * strreplace | ( | const char * | _orig, |
| const char * | _rep, | ||
| const char * | _with ) |
Definition at line 17133 of file _infrastructure.c.
| YY_BUFFER_STATE yy_create_buffer | ( | FILE * | file, |
| int | size ) |
| void yy_delete_buffer | ( | YY_BUFFER_STATE | b | ) |
| void yy_flush_buffer | ( | YY_BUFFER_STATE | b | ) |
| YY_BUFFER_STATE yy_scan_buffer | ( | char * | base, |
| yy_size_t | size ) |
| YY_BUFFER_STATE yy_scan_bytes | ( | const char * | bytes, |
| int | len ) |
| YY_BUFFER_STATE yy_scan_string | ( | const char * | yy_str | ) |
| void yy_switch_to_buffer | ( | YY_BUFFER_STATE | new_buffer | ) |
| void * yyalloc | ( | yy_size_t | ) |
| void yyfree | ( | void * | ) |
| int yyget_debug | ( | void | ) |
| YY_EXTRA_TYPE yyget_extra | ( | void | ) |
| FILE * yyget_in | ( | void | ) |
| int yyget_leng | ( | void | ) |
| int yyget_lineno | ( | void | ) |
| FILE * yyget_out | ( | void | ) |
| char * yyget_text | ( | void | ) |
|
extern |
| int yylex_destroy | ( | void | ) |
| void yypop_buffer_state | ( | void | ) |
| void yypush_buffer_state | ( | YY_BUFFER_STATE | new_buffer | ) |
| void * yyrealloc | ( | void * | , |
| yy_size_t | ) |
| void yyrestart | ( | FILE * | input_file | ) |
| void yyset_debug | ( | int | debug_flag | ) |
| void yyset_extra | ( | YY_EXTRA_TYPE | user_defined | ) |
| void yyset_in | ( | FILE * | _in_str | ) |
| void yyset_lineno | ( | int | _line_number | ) |
| void yyset_out | ( | FILE * | _out_str | ) |
|
extern |
This function called by the scanner (the automaton generated by Flex) when it reaches the end of the file (EOF) it's reading. Its name stands for "wrap up" (to wrap up): its purpose is to decide whether the scanner's job is finished (1) or whether it should continue reading from another file (0).
Definition at line 237 of file ugbc.tab.c.
|
extern |
This variable will store an assembly code snippet within a program. This means that we're essentially treating the source code as a "data string". This technique is common in compiler development, emulator development, or when using inline assembly.
Definition at line 258 of file ugbc.tab.c.
|
extern |
This variable contains the list of file names of files included recursively. When a file is included with the INCLUDE command, its name is inserted into this stack, from top to bottom. Conversely, when the file is finished reading, its name is popped from the stack, which empties.
Definition at line 182 of file ugbc.tab.c.
|
extern |
This variable holds the name of the folder containing the set of definitions to be used with the IMPORT DECLARES command. Executing this statement loads the relevant ugBASIC file for the target in question from this location. If NULL, the import path will be search against the following paths: ../../imports, ../imports and, finally, ./imports.
Definition at line 250 of file ugbc.tab.c.
|
extern |
This variable contains the level of nested INCLUDED files, i.e. the last empty position on the stacked files.
Definition at line 174 of file ugbc.tab.c.
|
extern |
Definition at line 55 of file _infrastructure.c.
| YY_DECL |
The main scanner function which does all the work.
|
extern |
This variable keeps track of the current column number when reading the input file.
Definition at line 133 of file ugbc.tab.c.
|
extern |
This variable keeps track of the current column number when reading the input file of files included recursively. When a file is included with the INCLUDE command, its actual line number is inserted into this stack, from top to bottom. Conversely, when the file is finished reading, its name is popped from the stack, which empties..
Definition at line 200 of file ugbc.tab.c.
| int yyconcatlineno |
This variable keeps track of the concatenated line number when reading the input file. In BASIC, logical lines, with commands, parameters, and so on, can be written across multiple physical lines if the last character is an underscore. This variable keeps track of the line number within the set of linked lines. Therefore, this number resets to zero whenever a new line begins, unless the previous line ends with an underscore.
| int yylineno = 1 |
This variable keeps track of the current line number when reading the input file. Instead of having to manually count each newline character (
), we instructed Flex to automatically update this variable whenever it encounters a newline. In Bison, we ensured that Flex supports and exports it by using the command option yylineno option in the definitions section.
Since the variable is defined in the Flex-generated code, we declare it as extern in Bison's C section to access it. Without this variable, when Bison encounters a syntax error, the yyerror function would simply return a terse "syntax error." With this variable, we can provide much more precise feedback to the user. If we reuse the same parser to parse multiple files sequentially, we reset yylineno = 1; before starting to parse a new file. Currently, this variable only counts rows. If we need to know exactly which column an error is in (e.g., "line 10, character 5"), we use the more complex YYLTYPE structure with the locations in Bison.
|
extern |
This variable keeps track of the current line number when reading the input file of files included recursively. When a file is included with the INCLUDE command, its actual line number is inserted into this stack, from top to bottom. Conversely, when the file is finished reading, its name is popped from the stack, which empties..
Definition at line 191 of file ugbc.tab.c.
|
extern |
This variable keeps track of the current byte position when reading the input file.
Definition at line 138 of file ugbc.tab.c.
|
extern |
This variable keeps track of the current byte position when reading the input file of files included recursively. When a file is included with the INCLUDE command, its actual line number is inserted into this stack, from top to bottom. Conversely, when the file is finished reading, its name is popped from the stack, which empties.
Definition at line 209 of file ugbc.tab.c.