diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..33f016a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +RetroBASIC.xcodeproj/project.xcworkspace +RetroBASIC.xcodeproj/xcshareddata +RetroBASIC.xcodeproj/xcuserdata +DerivedData/ +vs/.vs +vs/RetroBASIC +vs/x64 \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..878370b8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "extern/getopt-for-windows"] + path = extern/getopt-for-windows + url = https://github.com/Chunde/getopt-for-windows +[submodule "extern/termiWin"] + path = extern/termiWin + url = https://github.com/veeso/termiWin diff --git a/extern/getopt-for-windows b/extern/getopt-for-windows new file mode 160000 index 00000000..76fe2df8 --- /dev/null +++ b/extern/getopt-for-windows @@ -0,0 +1 @@ +Subproject commit 76fe2df86f84771775fd2f1a641a09adbce28df7 diff --git a/extern/termiWin b/extern/termiWin new file mode 160000 index 00000000..0b72a8a5 --- /dev/null +++ b/extern/termiWin @@ -0,0 +1 @@ +Subproject commit 0b72a8a5d10d26746653eb520bdfcc86d2abb4c8 diff --git a/src/lex.yy.c b/src/lex.yy.c new file mode 100644 index 00000000..6483fb1a --- /dev/null +++ b/src/lex.yy.c @@ -0,0 +1,2930 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#include + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define YY_USES_REJECT + +#define yywrap() 1 +#define YY_SKIP_YYWRAP +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern int yylineno; +int yylineno = 1; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 175 +#define YY_END_OF_BUFFER 176 +static yyconst short int yy_acclist[388] = + { 0, + 170, 170, 176, 174, 175, 169, 174, 175, 168, 175, + 1, 174, 175, 4, 174, 175, 174, 175, 127, 174, + 175, 109, 174, 175, 3, 174, 175, 109, 174, 175, + 109, 174, 175, 164, 174, 175, 164, 174, 175, 164, + 174, 175, 109, 174, 175, 109, 174, 175, 109, 174, + 175, 166, 174, 175, 166, 174, 175, 166, 174, 175, + 166, 174, 175, 166, 174, 175, 166, 174, 175, 166, + 174, 175, 166, 174, 175, 166, 174, 175, 166, 174, + 175, 166, 169, 174, 175, 166, 174, 175, 166, 174, + 175, 166, 174, 175, 166, 174, 175, 166, 174, 175, + + 166, 174, 175, 166, 174, 175, 166, 174, 175, 166, + 174, 175, 166, 174, 175, 166, 174, 175, 170, 175, + 173, 175, 171, 175, 172, 175, 4, 167, 160, 3, + 114, 164, 164, 164, 121, 125, 122, 124, 126, 123, + 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 15, 166, 166, 166, 166, 166, 166, 166, + 166, 69, 166, 166, 166, 166, 166, 166, 166, 166, + 20, 166, 21, 166, 166, 116, 166, 166, 166, 71, + + 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 142, 166, 166, 31, 166, 166, 166, 166, 166, + 166, 166, 166, 170, 164, 163, 161, 162, 161, 162, + 163, 161, 162, 57, 58, 97, 115, 83, 59, 60, + 144, 5, 7, 33, 34, 155, 61, 64, 8, 159, + 10, 111, 11, 119, 106, 107, 55, 65, 66, 165, + 12, 98, 36, 146, 156, 120, 68, 157, 89, 17, + 105, 70, 153, 112, 113, 110, 19, 117, 148, 49, + 103, 37, 2, 78, 27, 74, 72, 76, 101, 100, + + 75, 44, 99, 79, 141, 166, 81, 158, 104, 82, + 118, 154, 41, 145, 32, 85, 143, 63, 62, 9, + 108, 35, 51, 165, 165, 67, 14, 147, 88, 18, + 149, 102, 22, 24, 2, 93, 73, 28, 29, 90, + 80, 30, 140, 53, 84, 6, 54, 13, 92, 16, + 91, 152, 86, 48, 23, 56, 77, 139, 43, 46, + 132, 131, 129, 130, 128, 96, 38, 151, 135, 40, + 39, 52, 26, 87, 136, 45, 150, 134, 133, 50, + 138, 25, 137, 94, 47, 42, 95 + } ; + +static yyconst short int yy_accept[431] = + { 0, + 1, 1, 1, 2, 3, 4, 6, 9, 11, 14, + 17, 19, 22, 25, 28, 31, 34, 37, 40, 43, + 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, + 76, 79, 82, 86, 89, 92, 95, 98, 101, 104, + 107, 110, 113, 116, 119, 121, 123, 125, 127, 128, + 128, 129, 130, 131, 132, 133, 133, 134, 135, 135, + 135, 135, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + + 173, 175, 176, 177, 178, 179, 180, 181, 182, 184, + 185, 186, 187, 188, 189, 190, 191, 193, 195, 196, + 198, 199, 200, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 224, 225, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, + 242, 244, 245, 246, 247, 248, 249, 250, 251, 251, + 252, 253, 253, 253, 253, 253, 253, 253, 254, 255, + 256, 257, 258, 259, 259, 260, 261, 262, 262, 263, + 264, 265, 266, 267, 268, 268, 268, 269, 270, 271, + + 272, 272, 273, 274, 274, 274, 274, 275, 276, 277, + 277, 277, 277, 277, 278, 279, 279, 279, 279, 279, + 280, 281, 282, 283, 284, 285, 285, 286, 287, 288, + 288, 289, 290, 290, 290, 290, 290, 291, 292, 292, + 293, 293, 293, 293, 294, 294, 294, 294, 294, 295, + 295, 296, 296, 297, 298, 299, 300, 301, 302, 302, + 302, 302, 302, 303, 304, 305, 305, 307, 307, 308, + 308, 309, 309, 309, 309, 310, 311, 311, 312, 313, + 313, 314, 315, 316, 316, 317, 317, 318, 319, 319, + 320, 321, 321, 321, 321, 321, 322, 322, 323, 324, + + 325, 326, 327, 327, 328, 329, 329, 329, 329, 329, + 329, 329, 329, 329, 330, 331, 332, 332, 332, 333, + 334, 334, 334, 334, 335, 336, 336, 336, 336, 336, + 336, 336, 337, 338, 338, 339, 340, 341, 341, 341, + 341, 342, 343, 344, 345, 345, 345, 345, 345, 346, + 346, 347, 347, 347, 347, 347, 347, 347, 348, 349, + 350, 350, 351, 352, 353, 353, 353, 354, 354, 355, + 356, 357, 357, 357, 357, 357, 357, 357, 358, 358, + 358, 358, 358, 359, 360, 360, 360, 361, 361, 362, + 362, 363, 364, 365, 366, 366, 367, 368, 369, 370, + + 371, 372, 372, 372, 372, 373, 374, 375, 376, 376, + 376, 377, 378, 379, 379, 380, 381, 381, 382, 383, + 384, 385, 385, 386, 386, 386, 387, 387, 388, 388 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, + 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 13, 14, 15, 16, 15, 17, 13, 18, 19, 20, + 20, 20, 20, 20, 20, 21, 21, 22, 13, 23, + 24, 25, 1, 26, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 13, 1, 13, 27, 28, 1, 29, 30, 31, 32, + + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 1, 55, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[56] = + { 0, + 1, 1, 2, 1, 1, 3, 1, 3, 3, 3, + 1, 1, 1, 1, 1, 4, 1, 5, 5, 5, + 5, 4, 1, 1, 1, 6, 7, 8, 9, 9, + 9, 9, 9, 9, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 1 + } ; + +static yyconst short int yy_base[441] = + { 0, + 0, 0, 53, 54, 721, 1060, 1060, 1060, 1060, 0, + 55, 1060, 0, 0, 1060, 701, 45, 62, 67, 35, + 48, 44, 93, 112, 98, 109, 60, 87, 124, 135, + 136, 142, 161, 94, 164, 174, 190, 192, 217, 231, + 249, 173, 195, 218, 0, 1060, 1060, 1060, 0, 87, + 1060, 0, 0, 1060, 270, 279, 286, 291, 91, 0, + 162, 167, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 203, + 307, 312, 317, 323, 329, 334, 339, 356, 364, 369, + 374, 415, 379, 384, 396, 404, 409, 427, 432, 441, + 457, 463, 470, 475, 480, 496, 502, 508, 522, 527, + + 532, 537, 576, 543, 551, 558, 569, 583, 589, 596, + 604, 626, 631, 636, 641, 651, 656, 661, 666, 671, + 676, 684, 692, 697, 702, 710, 718, 755, 724, 737, + 742, 762, 770, 777, 784, 800, 806, 812, 819, 824, + 832, 838, 851, 861, 867, 877, 882, 887, 898, 904, + 909, 923, 928, 0, 332, 409, 93, 0, 238, 0, + 107, 1060, 1060, 1060, 1060, 676, 1060, 1060, 676, 695, + 1060, 657, 654, 686, 662, 674, 643, 1060, 1060, 1060, + 623, 619, 1060, 625, 309, 1060, 1060, 609, 1060, 1060, + 1060, 1060, 1060, 87, 617, 595, 1060, 1060, 934, 1060, + + 607, 1060, 1060, 110, 584, 587, 620, 1060, 1060, 595, + 594, 573, 573, 1060, 1060, 586, 569, 569, 561, 1060, + 1060, 1060, 1060, 1060, 1060, 598, 1060, 1060, 1060, 553, + 1060, 591, 559, 543, 549, 550, 1060, 1060, 538, 1060, + 529, 540, 539, 0, 537, 151, 516, 527, 1060, 520, + 1060, 549, 1060, 518, 1060, 517, 1060, 1060, 500, 495, + 82, 487, 479, 1060, 488, 481, 1060, 488, 1060, 476, + 1060, 470, 468, 467, 1060, 1060, 461, 1060, 1060, 461, + 1060, 1060, 1060, 460, 1060, 448, 1060, 1060, 460, 1060, + 1060, 462, 445, 86, 439, 1060, 429, 1060, 1060, 1060, + + 948, 1060, 440, 1060, 1060, 408, 406, 408, 409, 413, + 404, 412, 435, 1060, 1060, 1060, 396, 401, 1060, 1060, + 374, 383, 365, 1060, 0, 378, 358, 359, 353, 348, + 363, 1060, 1060, 358, 1060, 1060, 1060, 339, 321, 335, + 1060, 1060, 235, 1060, 325, 328, 323, 320, 1060, 303, + 1060, 288, 290, 280, 279, 255, 248, 1060, 1060, 1060, + 284, 279, 1060, 1060, 253, 274, 1060, 240, 1060, 268, + 1060, 234, 224, 223, 230, 211, 240, 1060, 233, 205, + 191, 190, 1060, 1060, 198, 219, 1060, 175, 1060, 148, + 1060, 1060, 1060, 1060, 142, 1060, 1060, 1060, 1060, 1060, + + 1060, 126, 146, 115, 1060, 1060, 1060, 1060, 132, 255, + 1060, 1060, 1060, 88, 1060, 1060, 61, 1060, 1060, 1060, + 1060, 35, 1060, 41, 37, 1060, 52, 1060, 1060, 974, + 983, 992, 997, 1006, 1013, 1022, 1027, 1034, 1041, 1050 + } ; + +static yyconst short int yy_def[441] = + { 0, + 429, 1, 430, 430, 429, 429, 429, 429, 429, 431, + 432, 429, 433, 434, 429, 429, 429, 429, 429, 429, + 429, 429, 435, 435, 435, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 32, 25, 25, 25, 25, + 25, 25, 25, 25, 436, 429, 429, 429, 431, 432, + 429, 433, 434, 429, 429, 429, 429, 429, 429, 437, + 429, 437, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 438, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 436, 429, 429, 429, 437, 429, 62, + 62, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 439, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 440, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 440, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 0, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429 + } ; + +static yyconst short int yy_nxt[1116] = + { 0, + 6, 7, 8, 9, 7, 10, 11, 12, 6, 6, + 13, 14, 15, 16, 15, 15, 17, 18, 19, 19, + 19, 15, 20, 21, 22, 23, 15, 6, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 23, 23, 33, + 34, 35, 36, 37, 23, 38, 39, 40, 41, 42, + 23, 43, 23, 44, 6, 46, 46, 51, 63, 64, + 428, 51, 55, 55, 55, 55, 67, 68, 47, 47, + 65, 427, 66, 426, 48, 48, 425, 56, 57, 58, + 58, 58, 58, 57, 58, 58, 58, 58, 86, 51, + 337, 59, 87, 51, 56, 296, 88, 60, 69, 56, + + 69, 69, 69, 69, 61, 69, 69, 69, 157, 157, + 157, 157, 70, 60, 424, 70, 62, 69, 338, 69, + 69, 69, 111, 70, 161, 161, 77, 355, 89, 297, + 112, 90, 91, 356, 78, 423, 113, 80, 92, 70, + 420, 71, 72, 73, 81, 70, 70, 419, 82, 83, + 79, 84, 70, 74, 418, 85, 205, 206, 75, 76, + 93, 70, 417, 70, 70, 94, 95, 97, 99, 96, + 70, 70, 70, 100, 416, 101, 70, 98, 70, 159, + 159, 159, 102, 103, 160, 160, 161, 70, 70, 104, + 105, 106, 70, 107, 70, 415, 114, 108, 327, 328, + + 70, 151, 109, 110, 116, 70, 115, 117, 69, 70, + 69, 69, 69, 70, 70, 118, 70, 119, 121, 120, + 127, 414, 122, 70, 128, 70, 123, 413, 129, 412, + 411, 70, 124, 130, 131, 125, 410, 152, 126, 409, + 132, 408, 70, 383, 70, 70, 70, 70, 407, 133, + 153, 134, 406, 135, 70, 159, 159, 159, 136, 142, + 137, 138, 405, 421, 139, 140, 143, 144, 404, 141, + 70, 403, 145, 146, 402, 401, 147, 70, 148, 149, + 384, 400, 399, 70, 398, 70, 397, 55, 55, 55, + 55, 422, 396, 155, 395, 150, 156, 156, 156, 156, + + 394, 70, 56, 55, 55, 55, 55, 57, 58, 58, + 58, 58, 69, 393, 69, 69, 69, 69, 56, 69, + 69, 69, 69, 56, 69, 69, 69, 392, 69, 391, + 69, 69, 69, 390, 69, 389, 69, 69, 69, 69, + 292, 69, 69, 69, 69, 293, 69, 69, 69, 156, + 156, 156, 156, 162, 165, 294, 388, 387, 163, 166, + 386, 69, 164, 69, 69, 69, 385, 382, 381, 69, + 167, 69, 69, 69, 69, 168, 69, 69, 69, 69, + 380, 69, 69, 69, 69, 169, 69, 69, 69, 69, + 379, 69, 69, 69, 378, 377, 171, 170, 376, 375, + + 374, 69, 173, 69, 69, 69, 373, 372, 172, 69, + 180, 69, 69, 69, 69, 371, 69, 69, 69, 174, + 69, 370, 69, 69, 69, 181, 156, 156, 156, 156, + 182, 183, 69, 369, 69, 69, 69, 69, 368, 69, + 69, 69, 185, 367, 366, 365, 69, 175, 69, 69, + 69, 184, 364, 176, 363, 362, 186, 177, 361, 360, + 178, 179, 69, 190, 69, 69, 69, 187, 69, 359, + 69, 69, 69, 188, 358, 69, 189, 69, 69, 69, + 69, 357, 69, 69, 69, 69, 354, 69, 69, 69, + 191, 353, 352, 351, 350, 195, 192, 349, 193, 196, + + 348, 69, 194, 69, 69, 69, 197, 69, 347, 69, + 69, 69, 204, 69, 346, 69, 69, 69, 345, 344, + 343, 198, 342, 341, 201, 200, 340, 69, 202, 69, + 69, 69, 69, 339, 69, 69, 69, 69, 336, 69, + 69, 69, 69, 335, 69, 69, 69, 334, 69, 203, + 69, 69, 69, 333, 205, 206, 69, 332, 69, 69, + 69, 331, 330, 69, 329, 69, 69, 69, 208, 326, + 324, 323, 216, 207, 69, 322, 69, 69, 69, 321, + 209, 69, 320, 69, 69, 69, 218, 319, 69, 318, + 69, 69, 69, 217, 69, 317, 69, 69, 69, 316, + + 315, 69, 219, 69, 69, 69, 314, 210, 313, 69, + 220, 69, 69, 69, 211, 312, 221, 311, 310, 212, + 309, 308, 213, 214, 222, 215, 307, 306, 305, 304, + 223, 69, 303, 69, 69, 69, 69, 302, 69, 69, + 69, 69, 299, 69, 69, 69, 69, 298, 69, 69, + 69, 224, 295, 291, 290, 225, 69, 226, 69, 69, + 69, 69, 228, 69, 69, 69, 69, 227, 69, 69, + 69, 69, 289, 69, 69, 69, 69, 288, 69, 69, + 69, 69, 287, 69, 69, 69, 229, 230, 231, 69, + 286, 69, 69, 69, 285, 284, 283, 69, 232, 69, + + 69, 69, 69, 282, 69, 69, 69, 69, 281, 69, + 69, 69, 280, 233, 54, 69, 235, 69, 69, 69, + 429, 429, 429, 69, 234, 69, 69, 69, 429, 69, + 429, 69, 69, 69, 429, 236, 429, 429, 239, 429, + 237, 429, 69, 238, 69, 69, 69, 69, 429, 69, + 69, 69, 429, 429, 241, 429, 429, 240, 248, 242, + 69, 429, 69, 69, 69, 429, 429, 69, 249, 69, + 69, 69, 429, 429, 429, 69, 429, 69, 69, 69, + 429, 429, 69, 243, 69, 69, 69, 429, 429, 69, + 250, 69, 69, 69, 429, 244, 429, 429, 245, 429, + + 429, 246, 247, 251, 252, 69, 429, 69, 69, 69, + 429, 69, 429, 69, 69, 69, 429, 69, 253, 69, + 69, 69, 429, 429, 69, 254, 69, 69, 69, 69, + 429, 69, 69, 69, 256, 255, 257, 69, 429, 69, + 69, 69, 429, 69, 429, 69, 69, 69, 429, 429, + 429, 259, 429, 262, 429, 429, 69, 258, 69, 69, + 69, 260, 429, 429, 261, 429, 69, 264, 69, 267, + 69, 429, 69, 429, 69, 69, 69, 429, 263, 265, + 429, 429, 69, 266, 69, 69, 69, 69, 429, 69, + 69, 69, 69, 429, 69, 69, 69, 429, 429, 429, + + 429, 268, 269, 69, 429, 69, 69, 69, 429, 69, + 270, 69, 69, 69, 69, 429, 69, 69, 69, 429, + 429, 429, 429, 271, 429, 429, 273, 429, 69, 272, + 69, 69, 69, 69, 429, 69, 69, 69, 429, 300, + 274, 300, 300, 300, 429, 429, 429, 429, 276, 275, + 429, 429, 429, 300, 277, 300, 300, 300, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 278, 429, + 429, 429, 429, 279, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 49, 429, 49, 49, 49, 49, 49, + 49, 49, 50, 50, 50, 50, 50, 50, 429, 50, + + 50, 52, 429, 429, 429, 52, 53, 429, 53, 53, + 53, 53, 53, 53, 53, 70, 429, 70, 429, 429, + 70, 70, 154, 429, 154, 429, 154, 154, 154, 154, + 154, 158, 429, 429, 429, 158, 199, 429, 429, 199, + 429, 429, 199, 301, 429, 301, 429, 429, 301, 301, + 325, 429, 325, 325, 325, 325, 325, 325, 325, 5, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429 + } ; + +static yyconst short int yy_chk[1116] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 4, 11, 20, 20, + 427, 11, 17, 17, 17, 17, 22, 22, 3, 4, + 21, 425, 21, 424, 3, 4, 422, 17, 18, 18, + 18, 18, 18, 19, 19, 19, 19, 19, 27, 50, + 261, 18, 27, 50, 18, 194, 27, 18, 23, 19, + + 23, 23, 23, 25, 18, 25, 25, 25, 59, 59, + 157, 157, 27, 18, 417, 28, 18, 24, 261, 24, + 24, 24, 34, 28, 161, 161, 25, 294, 28, 194, + 34, 28, 28, 294, 25, 414, 34, 26, 28, 28, + 409, 24, 24, 24, 26, 26, 34, 404, 26, 26, + 25, 26, 29, 24, 403, 26, 204, 204, 24, 24, + 29, 26, 402, 30, 31, 29, 29, 30, 31, 29, + 32, 30, 31, 32, 395, 32, 29, 30, 32, 61, + 61, 61, 32, 32, 62, 62, 62, 30, 31, 33, + 33, 33, 35, 33, 32, 390, 35, 33, 246, 246, + + 35, 42, 33, 33, 36, 36, 35, 36, 70, 42, + 70, 70, 70, 33, 36, 36, 35, 36, 37, 36, + 38, 388, 37, 43, 38, 42, 37, 386, 38, 385, + 382, 43, 37, 38, 38, 37, 381, 43, 37, 380, + 38, 379, 37, 343, 38, 39, 44, 43, 377, 39, + 44, 39, 376, 39, 44, 159, 159, 159, 39, 40, + 39, 39, 375, 410, 39, 39, 40, 40, 374, 39, + 44, 373, 40, 40, 372, 370, 40, 41, 41, 41, + 343, 368, 366, 40, 365, 41, 362, 55, 55, 55, + 55, 410, 361, 56, 357, 41, 56, 56, 56, 56, + + 356, 41, 55, 57, 57, 57, 57, 58, 58, 58, + 58, 58, 71, 355, 71, 71, 71, 72, 57, 72, + 72, 72, 73, 58, 73, 73, 73, 354, 74, 353, + 74, 74, 74, 352, 75, 350, 75, 75, 75, 76, + 185, 76, 76, 76, 77, 185, 77, 77, 77, 155, + 155, 155, 155, 71, 74, 185, 348, 347, 72, 75, + 346, 78, 73, 78, 78, 78, 345, 340, 339, 79, + 75, 79, 79, 79, 80, 76, 80, 80, 80, 81, + 338, 81, 81, 81, 83, 77, 83, 83, 83, 84, + 334, 84, 84, 84, 331, 330, 79, 78, 329, 328, + + 327, 85, 81, 85, 85, 85, 326, 323, 80, 86, + 83, 86, 86, 86, 87, 322, 87, 87, 87, 81, + 82, 321, 82, 82, 82, 84, 156, 156, 156, 156, + 84, 85, 88, 318, 88, 88, 88, 89, 317, 89, + 89, 89, 87, 313, 312, 311, 90, 82, 90, 90, + 90, 86, 310, 82, 309, 308, 87, 82, 307, 306, + 82, 82, 91, 89, 91, 91, 91, 88, 92, 303, + 92, 92, 92, 88, 297, 93, 88, 93, 93, 93, + 94, 295, 94, 94, 94, 95, 293, 95, 95, 95, + 90, 292, 289, 286, 284, 92, 91, 280, 91, 92, + + 277, 96, 91, 96, 96, 96, 92, 97, 274, 97, + 97, 97, 98, 98, 273, 98, 98, 98, 272, 270, + 268, 93, 266, 265, 96, 95, 263, 99, 96, 99, + 99, 99, 100, 262, 100, 100, 100, 101, 260, 101, + 101, 101, 102, 259, 102, 102, 102, 256, 104, 97, + 104, 104, 104, 254, 98, 98, 105, 252, 105, 105, + 105, 250, 248, 106, 247, 106, 106, 106, 100, 245, + 243, 242, 104, 99, 107, 241, 107, 107, 107, 239, + 102, 103, 236, 103, 103, 103, 106, 235, 108, 234, + 108, 108, 108, 105, 109, 233, 109, 109, 109, 232, + + 230, 110, 107, 110, 110, 110, 226, 103, 219, 111, + 107, 111, 111, 111, 103, 218, 107, 217, 216, 103, + 213, 212, 103, 103, 108, 103, 211, 210, 207, 206, + 110, 112, 205, 112, 112, 112, 113, 201, 113, 113, + 113, 114, 196, 114, 114, 114, 115, 195, 115, 115, + 115, 111, 188, 184, 182, 111, 116, 112, 116, 116, + 116, 117, 113, 117, 117, 117, 118, 112, 118, 118, + 118, 119, 181, 119, 119, 119, 120, 177, 120, 120, + 120, 121, 176, 121, 121, 121, 114, 114, 115, 122, + 175, 122, 122, 122, 174, 173, 172, 123, 116, 123, + + 123, 123, 124, 170, 124, 124, 124, 125, 169, 125, + 125, 125, 166, 119, 16, 126, 122, 126, 126, 126, + 5, 0, 0, 127, 121, 127, 127, 127, 0, 129, + 0, 129, 129, 129, 0, 124, 0, 0, 125, 0, + 124, 0, 130, 124, 130, 130, 130, 131, 0, 131, + 131, 131, 0, 0, 127, 0, 0, 126, 129, 127, + 128, 0, 128, 128, 128, 0, 0, 132, 130, 132, + 132, 132, 0, 0, 0, 133, 0, 133, 133, 133, + 0, 0, 134, 128, 134, 134, 134, 0, 0, 135, + 131, 135, 135, 135, 0, 128, 0, 0, 128, 0, + + 0, 128, 128, 132, 133, 136, 0, 136, 136, 136, + 0, 137, 0, 137, 137, 137, 0, 138, 134, 138, + 138, 138, 0, 0, 139, 135, 139, 139, 139, 140, + 0, 140, 140, 140, 137, 136, 137, 141, 0, 141, + 141, 141, 0, 142, 0, 142, 142, 142, 0, 0, + 0, 139, 0, 140, 0, 0, 143, 138, 143, 143, + 143, 139, 0, 0, 139, 0, 144, 142, 144, 144, + 144, 0, 145, 0, 145, 145, 145, 0, 141, 142, + 0, 0, 146, 143, 146, 146, 146, 147, 0, 147, + 147, 147, 148, 0, 148, 148, 148, 0, 0, 0, + + 0, 144, 145, 149, 0, 149, 149, 149, 0, 150, + 147, 150, 150, 150, 151, 0, 151, 151, 151, 0, + 0, 0, 0, 147, 0, 0, 149, 0, 152, 148, + 152, 152, 152, 153, 0, 153, 153, 153, 0, 199, + 150, 199, 199, 199, 0, 0, 0, 0, 151, 150, + 0, 0, 0, 301, 151, 301, 301, 301, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, + 0, 0, 0, 153, 430, 430, 430, 430, 430, 430, + 430, 430, 430, 431, 0, 431, 431, 431, 431, 431, + 431, 431, 432, 432, 432, 432, 432, 432, 0, 432, + + 432, 433, 0, 0, 0, 433, 434, 0, 434, 434, + 434, 434, 434, 434, 434, 435, 0, 435, 0, 0, + 435, 435, 436, 0, 436, 0, 436, 436, 436, 436, + 436, 437, 0, 0, 0, 437, 438, 0, 0, 438, + 0, 0, 438, 439, 0, 439, 0, 0, 439, 439, + 440, 0, 440, 440, 440, 440, 440, 440, 440, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429 + } ; + +static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; +static char *yy_full_match; +static int yy_lp; +#define REJECT \ +{ \ +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ +yy_cp = yy_full_match; /* restore poss. backed-over text */ \ +++yy_lp; \ +goto find_rule; \ +} +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 ".\\scan.l" +#define INITIAL 0 +#line 2 ".\\scan.l" +/* Lexical analyser for RetroBASIC + Copyright (C) 2020 Maury Markowitz + + Based on gnbasic + Copyright (C) 1998 James Bowman + +This file is part of RetroBASIC. + +RetroBASIC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +RetroBASIC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with RetroBASIC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/** + * @file scan.l + * @author Maury Markowitz + * @brief lex/flex scanner + * + */ + +#include "retrobasic.h" +#include "strng.h" +#include "parse.h" + +//%option nodefault +#define DATA_STATEMENT 1 + +#line 846 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 45 ".\\scan.l" + + + /* end of file */ +#line 1001 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 430 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 1060 ); + +yy_find_action: + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yy_lp]; + { + yy_full_match = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + ++yylineno; + } + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 48 ".\\scan.l" +{ + yyterminate(); + } + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(DATA_STATEMENT): +#line 51 ".\\scan.l" +{ + yyterminate(); + } + YY_BREAK +/* statements */ +/* REM statements are odd because they consist of a token and a line of text, but + the rest of the line is part of the statement. If you want to keep the REM part as + a separate token, this is the simplest solution. See: + https://stackoverflow.com/questions/59117309/rest-of-line-in-bison/59122569#59122569 + */ +case 2: +YY_RULE_SETUP +#line 61 ".\\scan.l" +{ yylval.s = str_new(str_copy(yytext + 3, yyleng - 3)); return REM; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 62 ".\\scan.l" +{ yylval.s = str_new(str_copy(yytext + 1, yyleng - 1)); return QUOTEREM; } // short form in MS + YY_BREAK +case 4: +YY_RULE_SETUP +#line 63 ".\\scan.l" +{ yylval.s = str_new(str_copy(yytext + 1, yyleng - 1)); return BANGREM; } // later MS allow bang as well + YY_BREAK +case 5: +YY_RULE_SETUP +#line 64 ".\\scan.l" +{ return BYE; } // also SYSTEM and GOODBYE + YY_BREAK +case 6: +YY_RULE_SETUP +#line 65 ".\\scan.l" +{ return CLEAR; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 66 ".\\scan.l" +{ return CLEAR; } // synonyms + YY_BREAK +case 8: +YY_RULE_SETUP +#line 67 ".\\scan.l" +{ return DEF; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 68 ".\\scan.l" +{ BEGIN(DATA_STATEMENT); return DATA; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 69 ".\\scan.l" +{ return DIM; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 70 ".\\scan.l" +{ return END; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 71 ".\\scan.l" +{ return FOR; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 72 ".\\scan.l" +{ return GOSUB; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 73 ".\\scan.l" +{ return GOTO; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 74 ".\\scan.l" +{ return IF; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 75 ".\\scan.l" +{ return INPUT; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 76 ".\\scan.l" +{ return LET; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 77 ".\\scan.l" +{ return NEXT; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 78 ".\\scan.l" +{ return NEW; } // also CLEAR (sometimes with options), ERASE and SCRATCH + YY_BREAK +case 20: +YY_RULE_SETUP +#line 79 ".\\scan.l" +{ return OF; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 80 ".\\scan.l" +{ return ON; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 81 ".\\scan.l" +{ return POKE; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 82 ".\\scan.l" +{ return PRINT; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 83 ".\\scan.l" +{ return READ; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 84 ".\\scan.l" +{ return RESTORE; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 85 ".\\scan.l" +{ return RETURN; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 86 ".\\scan.l" +{ return RUN; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 87 ".\\scan.l" +{ return STEP; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 88 ".\\scan.l" +{ return STOP; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 89 ".\\scan.l" +{ return THEN; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 90 ".\\scan.l" +{ return TO; } + YY_BREAK +/* extended statements found in some versions*/ +case 32: +YY_RULE_SETUP +#line 93 ".\\scan.l" +{ return CALL; } // used to call system functions in TI-99 and some other BASICs + YY_BREAK +case 33: +YY_RULE_SETUP +#line 94 ".\\scan.l" +{ return CLS; } // clear screen, do not confuse with CLR or CLEAR + YY_BREAK +case 34: +YY_RULE_SETUP +#line 95 ".\\scan.l" +{ return CMD; } // redirects output of PRINT to another device + YY_BREAK +case 35: +YY_RULE_SETUP +#line 96 ".\\scan.l" +{ return CALL; } // + YY_BREAK +case 36: +YY_RULE_SETUP +#line 97 ".\\scan.l" +{ return GET; } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 98 ".\\scan.l" +{ return PUT; } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 99 ".\\scan.l" +{ return INPUT_FILE; } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 100 ".\\scan.l" +{ return PRINT_FILE; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 101 ".\\scan.l" +{ return OPTION; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 102 ".\\scan.l" +{ return BASE; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 103 ".\\scan.l" +{ return RANDOMIZE; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 104 ".\\scan.l" +{ return RANDOMIZE; } // this returns the RANDOMIZE token instead of making a new one + YY_BREAK +case 44: +YY_RULE_SETUP +#line 105 ".\\scan.l" +{ return SYS; } // same as CALL + YY_BREAK +case 45: +YY_RULE_SETUP +#line 106 ".\\scan.l" +{ return SYS; } // same as CALL + YY_BREAK +case 46: +YY_RULE_SETUP +#line 107 ".\\scan.l" +{ return USING; } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 108 ".\\scan.l" +{ return VARLIST; } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 109 ".\\scan.l" +{ return PAUSE; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 110 ".\\scan.l" +{ return POP; } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 111 ".\\scan.l" +{ return POP; } // same as POP + YY_BREAK +case 51: +YY_RULE_SETUP +#line 112 ".\\scan.l" +{ return EXIT; } // slightly different than pop + YY_BREAK +case 52: +YY_RULE_SETUP +#line 113 ".\\scan.l" +{ return RESUME; } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 114 ".\\scan.l" +{ return TRAP; } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 115 ".\\scan.l" +{ return ERROR; } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 116 ".\\scan.l" +{ return ERROR; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 117 ".\\scan.l" +{ return RAISE; } + YY_BREAK +/* math functions */ +case 57: +YY_RULE_SETUP +#line 120 ".\\scan.l" +{ return ABS; } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 121 ".\\scan.l" +{ return ACS; } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 122 ".\\scan.l" +{ return ASN; } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 123 ".\\scan.l" +{ return ATN; } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 124 ".\\scan.l" +{ return COS; } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 125 ".\\scan.l" +{ return COSH; } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 126 ".\\scan.l" +{ return CLOG; } // CLG on Honeywell Series 60 + YY_BREAK +case 64: +YY_RULE_SETUP +#line 127 ".\\scan.l" +{ return COSH; } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 128 ".\\scan.l" +{ return EXP; } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 129 ".\\scan.l" +{ return FIX; } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 130 ".\\scan.l" +{ return FRAC; } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 131 ".\\scan.l" +{ return INT; } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 132 ".\\scan.l" +{ return LOG; } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 133 ".\\scan.l" +{ return LOG; } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 134 ".\\scan.l" +{ return PI; } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 135 ".\\scan.l" +{ return SIN; } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 136 ".\\scan.l" +{ return SINH; } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 137 ".\\scan.l" +{ return SGN; } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 138 ".\\scan.l" +{ return SQR; } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 139 ".\\scan.l" +{ return SINH; } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 140 ".\\scan.l" +{ return ROUND; } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 141 ".\\scan.l" +{ return RND; } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 142 ".\\scan.l" +{ return TAN; } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 143 ".\\scan.l" +{ return TANH; } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 144 ".\\scan.l" +{ return TANH; } + YY_BREAK +case 82: +YY_RULE_SETUP +#line 145 ".\\scan.l" +{ return VAL; } + YY_BREAK +/* string-related functions */ +case 83: +YY_RULE_SETUP +#line 148 ".\\scan.l" +{ return ASC; } // CODE on Sinclair due to being non-ASCII, CH on Atom (no parens) + YY_BREAK +case 84: +YY_RULE_SETUP +#line 149 ".\\scan.l" +{ return ASC; } // DEC version of ASC + YY_BREAK +case 85: +YY_RULE_SETUP +#line 150 ".\\scan.l" +{ return CHR; } // CHR (SOL and SWTP), CHAR (MAX-BASIC), CHAR$ (Micropolis) + YY_BREAK +case 86: +YY_RULE_SETUP +#line 151 ".\\scan.l" +{ return LEFT; } + YY_BREAK +case 87: +YY_RULE_SETUP +#line 152 ".\\scan.l" +{ return RIGHT; } + YY_BREAK +case 88: +YY_RULE_SETUP +#line 153 ".\\scan.l" +{ return MID; } + YY_BREAK +case 89: +YY_RULE_SETUP +#line 154 ".\\scan.l" +{ return LEN; } + YY_BREAK +case 90: +YY_RULE_SETUP +#line 155 ".\\scan.l" +{ return STR; } // also NUM$ in some dialects + YY_BREAK +case 91: +YY_RULE_SETUP +#line 156 ".\\scan.l" +{ return INSTR; } // also INDEX and POS + YY_BREAK +case 92: +YY_RULE_SETUP +#line 157 ".\\scan.l" +{ return INSTR; } // also FIND and other variations + YY_BREAK +/* aliases for MID found in some versions */ +case 93: +YY_RULE_SETUP +#line 159 ".\\scan.l" +{ return MID; } + YY_BREAK +case 94: +YY_RULE_SETUP +#line 160 ".\\scan.l" +{ return MID; } + YY_BREAK +case 95: +YY_RULE_SETUP +#line 161 ".\\scan.l" +{ return MID; } + YY_BREAK +/* aliases for MID found in some versions */ +case 96: +YY_RULE_SETUP +#line 163 ".\\scan.l" +{ return INKEY; } + YY_BREAK +/* system functions */ +case 97: +YY_RULE_SETUP +#line 166 ".\\scan.l" +{ return ADR; } + YY_BREAK +case 98: +YY_RULE_SETUP +#line 167 ".\\scan.l" +{ return FRE; } + YY_BREAK +case 99: +YY_RULE_SETUP +#line 168 ".\\scan.l" +{ return TAB; } // also a statement in Integer BASIC + YY_BREAK +case 100: +YY_RULE_SETUP +#line 169 ".\\scan.l" +{ return SPC; } + YY_BREAK +case 101: +YY_RULE_SETUP +#line 170 ".\\scan.l" +{ return SPC; } // from HP, same as SPC + YY_BREAK +case 102: +YY_RULE_SETUP +#line 171 ".\\scan.l" +{ return PEEK; } // also EXAM (North Star) and FETCH (Digital Group Opus) + YY_BREAK +case 103: +YY_RULE_SETUP +#line 172 ".\\scan.l" +{ return POS; } // COUNT in Atom + YY_BREAK +case 104: +YY_RULE_SETUP +#line 173 ".\\scan.l" +{ return USR; } + YY_BREAK +case 105: +YY_RULE_SETUP +#line 174 ".\\scan.l" +{ return LIN; } + YY_BREAK +case 106: +YY_RULE_SETUP +#line 175 ".\\scan.l" +{ return EL; } + YY_BREAK +case 107: +YY_RULE_SETUP +#line 176 ".\\scan.l" +{ return ER; } + YY_BREAK +case 108: +YY_RULE_SETUP +#line 177 ".\\scan.l" +{ return ERR; } + YY_BREAK +/* various operators and punctuation */ +case 109: +YY_RULE_SETUP +#line 180 ".\\scan.l" +{ return yytext[0]; } + YY_BREAK +case 110: +YY_RULE_SETUP +#line 181 ".\\scan.l" +{ return MOD; } + YY_BREAK +case 111: +YY_RULE_SETUP +#line 182 ".\\scan.l" +{ return DIV; } + YY_BREAK +case 112: +YY_RULE_SETUP +#line 183 ".\\scan.l" +{ return MAX; } + YY_BREAK +case 113: +YY_RULE_SETUP +#line 184 ".\\scan.l" +{ return MIN; } + YY_BREAK +/* alternate form for power */ +case 114: +YY_RULE_SETUP +#line 187 ".\\scan.l" +{ return '^'; } // FIXME: we should have a separate token for this? + YY_BREAK +/* binary operators */ +case 115: +YY_RULE_SETUP +#line 190 ".\\scan.l" +{ return AND; } + YY_BREAK +case 116: +YY_RULE_SETUP +#line 191 ".\\scan.l" +{ return OR; } + YY_BREAK +case 117: +YY_RULE_SETUP +#line 192 ".\\scan.l" +{ return NOT; } + YY_BREAK +case 118: +YY_RULE_SETUP +#line 193 ".\\scan.l" +{ return XOR; } + YY_BREAK +case 119: +YY_RULE_SETUP +#line 194 ".\\scan.l" +{ return EQV; } + YY_BREAK +case 120: +YY_RULE_SETUP +#line 195 ".\\scan.l" +{ return IMP; } + YY_BREAK +/* comparison operators */ +case 121: +YY_RULE_SETUP +#line 198 ".\\scan.l" +{ return CMP_LE; } + YY_BREAK +case 122: +YY_RULE_SETUP +#line 199 ".\\scan.l" +{ return CMP_LE; } + YY_BREAK +case 123: +YY_RULE_SETUP +#line 200 ".\\scan.l" +{ return CMP_GE; } + YY_BREAK +case 124: +YY_RULE_SETUP +#line 201 ".\\scan.l" +{ return CMP_GE; } + YY_BREAK +case 125: +YY_RULE_SETUP +#line 202 ".\\scan.l" +{ return CMP_NE; } + YY_BREAK +case 126: +YY_RULE_SETUP +#line 203 ".\\scan.l" +{ return CMP_NE; } + YY_BREAK +case 127: +YY_RULE_SETUP +#line 204 ".\\scan.l" +{ return CMP_HASH; } // use a separate token here to preserve it in LIST + YY_BREAK +/* defs added in Extended BASIC */ +/* FIXME: these are actually easy to do, simply run them as DIMs so they get entered into the var list */ +case 128: +YY_RULE_SETUP +#line 208 ".\\scan.l" +{ return DEFSTR; } + YY_BREAK +case 129: +YY_RULE_SETUP +#line 209 ".\\scan.l" +{ return DEFINT; } + YY_BREAK +case 130: +YY_RULE_SETUP +#line 210 ".\\scan.l" +{ return DEFSNG; } + YY_BREAK +case 131: +YY_RULE_SETUP +#line 211 ".\\scan.l" +{ return DEFDBL; } + YY_BREAK +/* other string commands and functions */ +case 132: +YY_RULE_SETUP +#line 214 ".\\scan.l" +{ return CHANGE; } + YY_BREAK +case 133: +YY_RULE_SETUP +#line 215 ".\\scan.l" +{ return CONVERT; } + YY_BREAK +case 134: +YY_RULE_SETUP +#line 216 ".\\scan.l" +{ return UCASE; } + YY_BREAK +case 135: +YY_RULE_SETUP +#line 217 ".\\scan.l" +{ return LCASE; } + YY_BREAK +case 136: +YY_RULE_SETUP +#line 218 ".\\scan.l" +{ return SPC; } // returns n spaces as a value, which is how our SPC works anyway + YY_BREAK +case 137: +YY_RULE_SETUP +#line 219 ".\\scan.l" +{ return STRNG; } // returns n copies of a given string + YY_BREAK +case 138: +YY_RULE_SETUP +#line 220 ".\\scan.l" +{ return STRNG; } // alternate form of STRING + YY_BREAK +/* commodore-style TIME and TIME$ */ +case 139: +YY_RULE_SETUP +#line 223 ".\\scan.l" +{ return TIME_STR; } + YY_BREAK +case 140: +YY_RULE_SETUP +#line 224 ".\\scan.l" +{ return TIME; } + YY_BREAK +/* and their alternate short forms */ +case 141: +YY_RULE_SETUP +#line 226 ".\\scan.l" +{ return TIME_STR; } + YY_BREAK +case 142: +YY_RULE_SETUP +#line 227 ".\\scan.l" +{ return TIME; } + YY_BREAK +case 143: +YY_RULE_SETUP +#line 228 ".\\scan.l" +{ return TIME_STR; } // from BASIC-PLUS, Univac System 9 has CLK(x) where x is numeric + YY_BREAK +/* HEX, OCT and BIN conversions */ +case 144: +YY_RULE_SETUP +#line 231 ".\\scan.l" +{ return BIN; } + YY_BREAK +case 145: +YY_RULE_SETUP +#line 232 ".\\scan.l" +{ return BINSTR; } + YY_BREAK +case 146: +YY_RULE_SETUP +#line 233 ".\\scan.l" +{ return HEX; } + YY_BREAK +case 147: +YY_RULE_SETUP +#line 234 ".\\scan.l" +{ return HEXSTR; } + YY_BREAK +case 148: +YY_RULE_SETUP +#line 235 ".\\scan.l" +{ return OCT; } + YY_BREAK +case 149: +YY_RULE_SETUP +#line 236 ".\\scan.l" +{ return OCTSTR; } + YY_BREAK +/* array utilities */ +case 150: +YY_RULE_SETUP +#line 239 ".\\scan.l" +{ return UBOUND; } + YY_BREAK +case 151: +YY_RULE_SETUP +#line 240 ".\\scan.l" +{ return LBOUND; } + YY_BREAK +/* line labels, procedures, etc. */ +case 152: +YY_RULE_SETUP +#line 243 ".\\scan.l" +{ return LABEL; } + YY_BREAK +/* matrix commands and functions */ +case 153: +YY_RULE_SETUP +#line 246 ".\\scan.l" +{ return MAT; } // assignments + YY_BREAK +case 154: +YY_RULE_SETUP +#line 247 ".\\scan.l" +{ return MATZER; } // zero matrix + YY_BREAK +case 155: +YY_RULE_SETUP +#line 248 ".\\scan.l" +{ return MATCON; } // all-1 matrix + YY_BREAK +case 156: +YY_RULE_SETUP +#line 249 ".\\scan.l" +{ return MATIDN; } // identity matrix + YY_BREAK +case 157: +YY_RULE_SETUP +#line 250 ".\\scan.l" +{ return MATINV; } // invert + YY_BREAK +case 158: +YY_RULE_SETUP +#line 251 ".\\scan.l" +{ return MATTRN; } // transpose + YY_BREAK +case 159: +YY_RULE_SETUP +#line 252 ".\\scan.l" +{ return MATDET; } // determinant + YY_BREAK +/* hex, oct and bin strings encoding numbers */ +case 160: +YY_RULE_SETUP +#line 255 ".\\scan.l" +{ + yylval.d = (double)strtol(yytext + 1, NULL, 16); + return NUMBER; + } + YY_BREAK +case 161: +YY_RULE_SETUP +#line 259 ".\\scan.l" +{ + yylval.d = (double)strtol(yytext + 2, NULL, 16); + return NUMBER; + } + YY_BREAK +case 162: +YY_RULE_SETUP +#line 263 ".\\scan.l" +{ + yylval.d = (double)strtol(yytext + 2, NULL, 8); + return NUMBER; + } + YY_BREAK +case 163: +YY_RULE_SETUP +#line 267 ".\\scan.l" +{ + yylval.d = (double)strtol(yytext + 2, NULL, 2); + return NUMBER; + } + YY_BREAK +/* other numeric constants and line numbers */ +case 164: +YY_RULE_SETUP +#line 273 ".\\scan.l" +{ + yylval.d = strtod(yytext, NULL); + return NUMBER; + } + YY_BREAK +/* user defined functions */ +case 165: +YY_RULE_SETUP +#line 279 ".\\scan.l" +{ + yylval.s = str_new(yytext); + return FUNCTION_NAME; + } + YY_BREAK +/* variable references */ +/* currently set to allow only one or two chars plus an optional type indicator + replace the ? with a * for multi-char variables */ +case 166: +YY_RULE_SETUP +#line 287 ".\\scan.l" +{ + yylval.s = str_new(yytext); + return VARIABLE_NAME; + } + YY_BREAK +/* string constants */ +case 167: +YY_RULE_SETUP +#line 293 ".\\scan.l" +{ + yytext[strlen(yytext) - 1] = '\0'; + yylval.s = str_new(yytext + 1); + return STRING; + } + YY_BREAK +/* preserve line ends */ +case 168: +YY_RULE_SETUP +#line 300 ".\\scan.l" +{ BEGIN(INITIAL); return '\n'; } + YY_BREAK +/* eat other whitespace */ +case 169: +YY_RULE_SETUP +#line 303 ".\\scan.l" +{ } + YY_BREAK +/* DATA statements convert everything to a string */ + +case 170: +YY_RULE_SETUP +#line 307 ".\\scan.l" +{ + // eat any leading and trailing whitespace + yytext = str_trim(yytext); + + // and quotes + yytext = str_unquote(yytext); + + yylval.s = str_new(yytext); + return STRING; + } + YY_BREAK +case 171: +YY_RULE_SETUP +#line 318 ".\\scan.l" +{ return ','; } // triggers the exprlist syntax + YY_BREAK +/* colons or line-ends end the data statement and reset the state */ +case 172: +YY_RULE_SETUP +#line 321 ".\\scan.l" +{ BEGIN(INITIAL); return ':'; } + YY_BREAK +case 173: +YY_RULE_SETUP +#line 322 ".\\scan.l" +{ BEGIN(INITIAL); return '\n'; } + YY_BREAK + +case 174: +YY_RULE_SETUP +#line 325 ".\\scan.l" +printf("Bad input character '%s' at line %d\n", yytext, yylineno); + YY_BREAK +case 175: +YY_RULE_SETUP +#line 327 ".\\scan.l" +ECHO; + YY_BREAK +#line 2048 "lex.yy.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 430 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 430 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 429); + if ( ! yy_is_jam ) + *yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ) + --yylineno; + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + if ( c == '\n' ) + ++yylineno; + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 327 ".\\scan.l" + diff --git a/src/main.c b/src/main.c index 8fa32b60..e6424cdc 100644 --- a/src/main.c +++ b/src/main.c @@ -18,7 +18,12 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef _WIN32 +#include "getopt.h" +#else #include +#endif + #include // used for getpid #include "retrobasic.h" diff --git a/src/parse.tab.c b/src/parse.tab.c new file mode 100644 index 00000000..e848c4e0 --- /dev/null +++ b/src/parse.tab.c @@ -0,0 +1,4900 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "parse.y" + +/* Parser for RetroBASIC + Copyright (C) 2020 Maury Markowitz + + Based on gnbasic + Copyright (C) 1998 James Bowman + +This file is part of RetroBASIC. + +RetroBASIC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +RetroBASIC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with RetroBASIC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/** + * @file parse.y + * @author Maury Markowitz + * @brief yacc/bison parser + * + */ + +#include "retrobasic.h" +#include "statistics.h" + +#define YYDEBUG 1 + + /* used to track the line number being processed so + that errors can report it */ +static double errline; + +void yyerror(const char *message) +{ + fprintf(stderr, "Syntax error at line %g: %s\n", errline, message); + exit(1); +} + +int yylex(void); + +static statement_t *make_statement(int t) +{ + statement_t *new = malloc(sizeof(*new)); + new->type = t; + return new; +} + +static expression_t *make_expression(expression_type_e t) +{ + expression_t *new = malloc(sizeof(*new)); + new->type = t; + return new; +} + +static expression_t *make_operator(int arity, int o) +{ + expression_t *new = make_expression(op); + new->parms.op.opcode = o; + new->parms.op.arity = arity; + return new; +} + + /************************************************************************/ + + + +/* Line 189 of yacc.c */ +#line 148 "parse.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + STRING = 258, + NUMBER = 259, + DOUBLE = 260, + SINGLE = 261, + INTEGER = 262, + VARIABLE_NAME = 263, + FUNCTION_NAME = 264, + HEX_STR = 265, + OCT_STR = 266, + BIN_STR = 267, + REM = 268, + QUOTEREM = 269, + BANGREM = 270, + BYE = 271, + CLEAR = 272, + CLR = 273, + DATA = 274, + DEF = 275, + DIM = 276, + END = 277, + EXIT = 278, + FOR = 279, + GET = 280, + GOSUB = 281, + GOTO = 282, + IF = 283, + INPUT = 284, + LET = 285, + LIST = 286, + NEXT = 287, + NEW = 288, + OF = 289, + ON = 290, + PRINT = 291, + PUT = 292, + READ = 293, + RETURN = 294, + RUN = 295, + STEP = 296, + STOP = 297, + THEN = 298, + TO = 299, + USING = 300, + WAIT = 301, + OPEN = 302, + CLOSE = 303, + STATUS = 304, + PRINT_FILE = 305, + INPUT_FILE = 306, + GET_FILE = 307, + PUT_FILE = 308, + CALL = 309, + CLS = 310, + CMD = 311, + OPTION = 312, + BASE = 313, + PEEK = 314, + POKE = 315, + POP = 316, + RANDOMIZE = 317, + SYS = 318, + VARLIST = 319, + PAUSE = 320, + SLEEP = 321, + RESTORE = 322, + ABS = 323, + SGN = 324, + CLOG = 325, + EXP = 326, + LOG = 327, + SQR = 328, + PI = 329, + RND = 330, + INT = 331, + FIX = 332, + FRAC = 333, + ROUND = 334, + CINT = 335, + CSNG = 336, + CDBL = 337, + MOD = 338, + MOD_INT = 339, + DIV = 340, + MAX = 341, + MIN = 342, + COS = 343, + SIN = 344, + ATN = 345, + ACS = 346, + ASN = 347, + TAN = 348, + COSH = 349, + SINH = 350, + TANH = 351, + ASC = 352, + LEFT = 353, + MID = 354, + RIGHT = 355, + LEN = 356, + STR = 357, + VAL = 358, + CHR = 359, + SEG = 360, + SUBSTR = 361, + INSTR = 362, + INKEY = 363, + AND = 364, + OR = 365, + NOT = 366, + XOR = 367, + EQV = 368, + IMP = 369, + CMP_LE = 370, + CMP_GE = 371, + CMP_NE = 372, + CMP_HASH = 373, + ADR = 374, + FRE = 375, + SPC = 376, + TAB = 377, + POS = 378, + USR = 379, + LIN = 380, + TRAP = 381, + RESUME = 382, + ERROR = 383, + RAISE = 384, + ERR = 385, + EL = 386, + ER = 387, + DEFSTR = 388, + DEFINT = 389, + DEFSNG = 390, + DEFDBL = 391, + CHANGE = 392, + CONVERT = 393, + UCASE = 394, + LCASE = 395, + STRNG = 396, + TIME = 397, + TIME_STR = 398, + HEX = 399, + OCT = 400, + BIN = 401, + HEXSTR = 402, + OCTSTR = 403, + BINSTR = 404, + UBOUND = 405, + LBOUND = 406, + LABEL = 407, + MAT = 408, + MATPRINT = 409, + MATINPUT = 410, + MATREAD = 411, + MATGET = 412, + MATPUT = 413, + MATZER = 414, + MATCON = 415, + MATIDN = 416, + MATTRN = 417, + MATINV = 418, + MATDET = 419, + MATADD = 420, + MATSUB = 421, + MATMUL = 422, + MATSCA = 423, + MATFIL = 424 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 80 "parse.y" + + double d; + int i; + char *s; + list_t *l; + statement_t *statement; + expression_t *expression; + variable_reference_t *variable; + + + +/* Line 214 of yacc.c */ +#line 365 "parse.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 377 "parse.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 5 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1932 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 187 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 30 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 231 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 363 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 424 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 170, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 182, 2, + 175, 176, 179, 177, 173, 178, 2, 183, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 171, 174, + 180, 172, 181, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 185, 2, 186, 184, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 5, 9, 13, 14, 15, 19, 21, + 25, 28, 31, 32, 34, 36, 38, 40, 43, 48, + 53, 55, 57, 59, 61, 64, 69, 72, 75, 78, + 81, 84, 86, 89, 91, 98, 107, 110, 113, 116, + 121, 124, 127, 132, 135, 140, 145, 150, 153, 158, + 161, 163, 165, 170, 175, 180, 184, 186, 189, 194, + 196, 199, 205, 208, 211, 213, 216, 219, 222, 224, + 227, 230, 233, 235, 237, 240, 242, 245, 248, 251, + 254, 258, 263, 266, 268, 270, 273, 277, 282, 289, + 296, 303, 312, 319, 323, 327, 331, 336, 344, 349, + 354, 362, 367, 375, 383, 393, 401, 403, 405, 409, + 411, 413, 415, 419, 421, 423, 425, 427, 429, 431, + 433, 435, 439, 441, 443, 445, 447, 451, 453, 455, + 457, 459, 461, 463, 465, 467, 470, 472, 474, 476, + 478, 482, 487, 492, 499, 501, 506, 513, 522, 524, + 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, + 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, + 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, + 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, + 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, + 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, + 646, 648, 650, 654, 659, 661, 666, 671, 676, 684, + 685, 687, 690, 692, 695, 697, 699, 701, 705, 709, + 713, 715 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 188, 0, -1, 189, -1, 188, 170, 189, -1, 188, + 1, 170, -1, -1, -1, 4, 190, 191, -1, 192, + -1, 192, 171, 191, -1, 191, 14, -1, 191, 15, + -1, -1, 13, -1, 14, -1, 15, -1, 16, -1, + 54, 193, -1, 137, 211, 44, 211, -1, 138, 211, + 44, 211, -1, 17, -1, 18, -1, 55, -1, 56, + -1, 19, 214, -1, 20, 210, 172, 193, -1, 136, + 216, -1, 134, 216, -1, 135, 216, -1, 133, 216, + -1, 21, 216, -1, 22, -1, 128, 193, -1, 23, + -1, 24, 211, 172, 193, 44, 193, -1, 24, 211, + 172, 193, 44, 193, 41, 193, -1, 25, 211, -1, + 26, 4, -1, 26, 193, -1, 26, 193, 34, 214, + -1, 27, 4, -1, 27, 193, -1, 27, 193, 34, + 214, -1, 29, 212, -1, 28, 193, 43, 4, -1, + 28, 193, 27, 4, -1, 28, 193, 43, 191, -1, + 152, 211, -1, 30, 211, 172, 193, -1, 32, 216, + -1, 32, -1, 33, -1, 35, 193, 27, 214, -1, + 35, 193, 26, 214, -1, 35, 128, 27, 214, -1, + 57, 58, 193, -1, 65, -1, 65, 193, -1, 60, + 193, 173, 193, -1, 61, -1, 36, 212, -1, 36, + 45, 193, 174, 212, -1, 37, 193, -1, 129, 193, + -1, 62, -1, 62, 193, -1, 62, 62, -1, 38, + 216, -1, 67, -1, 67, 193, -1, 127, 32, -1, + 127, 193, -1, 127, -1, 39, -1, 39, 193, -1, + 42, -1, 42, 193, -1, 141, 193, -1, 63, 193, + -1, 122, 193, -1, 143, 172, 193, -1, 30, 143, + 172, 193, -1, 126, 193, -1, 126, -1, 64, -1, + 46, 214, -1, 211, 172, 193, -1, 153, 211, 172, + 211, -1, 153, 211, 172, 175, 193, 176, -1, 153, + 211, 172, 211, 177, 211, -1, 153, 211, 172, 211, + 178, 211, -1, 153, 211, 172, 175, 193, 176, 179, + 211, -1, 153, 211, 172, 211, 179, 211, -1, 153, + 36, 212, -1, 153, 29, 212, -1, 153, 38, 216, + -1, 153, 211, 172, 160, -1, 153, 211, 172, 160, + 175, 214, 176, -1, 153, 211, 172, 164, -1, 153, + 211, 172, 159, -1, 153, 211, 172, 159, 175, 214, + 176, -1, 153, 211, 172, 161, -1, 153, 211, 172, + 161, 175, 214, 176, -1, 153, 211, 172, 163, 175, + 211, 176, -1, 153, 211, 172, 163, 175, 211, 176, + 173, 211, -1, 153, 211, 172, 162, 175, 211, 176, + -1, 194, -1, 196, -1, 194, 195, 196, -1, 109, + -1, 110, -1, 198, -1, 196, 197, 198, -1, 172, + -1, 180, -1, 181, -1, 115, -1, 116, -1, 117, + -1, 118, -1, 200, -1, 198, 199, 200, -1, 177, + -1, 178, -1, 182, -1, 202, -1, 200, 201, 202, + -1, 179, -1, 183, -1, 83, -1, 85, -1, 86, + -1, 87, -1, 184, -1, 204, -1, 203, 204, -1, + 178, -1, 111, -1, 209, -1, 205, -1, 205, 175, + 176, -1, 205, 175, 193, 176, -1, 206, 175, 193, + 176, -1, 207, 175, 193, 173, 193, 176, -1, 208, + -1, 208, 175, 193, 176, -1, 208, 175, 193, 173, + 193, 176, -1, 208, 175, 193, 173, 193, 173, 193, + 176, -1, 108, -1, 120, -1, 74, -1, 75, -1, + 142, -1, 143, -1, 131, -1, 132, -1, 164, -1, + 68, -1, 119, -1, 90, -1, 146, -1, 149, -1, + 104, -1, 70, -1, 88, -1, 71, -1, 77, -1, + 78, -1, 144, -1, 147, -1, 76, -1, 140, -1, + 101, -1, 125, -1, 72, -1, 145, -1, 148, -1, + 59, -1, 69, -1, 89, -1, 121, -1, 73, -1, + 102, -1, 122, -1, 103, -1, 139, -1, 124, -1, + 130, -1, 85, -1, 83, -1, 86, -1, 87, -1, + 98, -1, 100, -1, 141, -1, 107, -1, 123, -1, + 99, -1, 105, -1, 106, -1, 79, -1, 150, -1, + 151, -1, 160, -1, 161, -1, 163, -1, 162, -1, + 159, -1, 4, -1, 3, -1, 211, -1, 210, -1, + 175, 193, 176, -1, 9, 175, 214, 176, -1, 8, + -1, 8, 175, 214, 176, -1, 8, 185, 214, 186, + -1, 8, 175, 215, 176, -1, 8, 175, 214, 176, + 175, 215, 176, -1, -1, 193, -1, 212, 193, -1, + 213, -1, 212, 213, -1, 173, -1, 174, -1, 193, + -1, 214, 173, 193, -1, 193, 171, 193, -1, 193, + 44, 193, -1, 211, -1, 216, 173, 211, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 254, 254, 256, 258, 264, 268, 268, 275, 280, + 285, 290, 299, 303, 310, 317, 324, 330, 336, 344, + 352, 358, 364, 370, 376, 383, 391, 399, 407, 415, + 423, 430, 436, 443, 449, 463, 476, 483, 503, 523, + 535, 555, 575, 587, 594, 617, 637, 646, 654, 675, + 682, 689, 696, 708, 720, 731, 738, 744, 751, 759, + 765, 773, 781, 788, 795, 802, 809, 817, 824, 830, + 837, 846, 853, 859, 865, 872, 878, 885, 892, 899, + 906, 913, 920, 927, 934, 940, 947, 969, 989, 997, + 1014, 1031, 1045, 1062, 1069, 1076, 1084, 1091, 1099, 1108, + 1115, 1123, 1130, 1138, 1146, 1156, 1168, 1171, 1173, 1183, + 1184, 1188, 1190, 1232, 1233, 1234, 1235, 1236, 1237, 1238, + 1242, 1244, 1264, 1265, 1266, 1270, 1272, 1281, 1282, 1283, + 1284, 1285, 1286, 1287, 1290, 1292, 1301, 1302, 1306, 1309, + 1316, 1322, 1329, 1336, 1345, 1352, 1360, 1369, 1381, 1382, + 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1394, 1395, 1396, + 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, + 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, + 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1429, 1430, + 1431, 1432, 1433, 1434, 1435, 1440, 1441, 1442, 1443, 1444, + 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1460, 1517, + 1536, 1543, 1550, 1561, 1571, 1583, 1595, 1609, 1622, 1637, + 1641, 1650, 1659, 1667, 1677, 1682, 1690, 1695, 1705, 1711, + 1735, 1740 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "STRING", "NUMBER", "DOUBLE", "SINGLE", + "INTEGER", "VARIABLE_NAME", "FUNCTION_NAME", "HEX_STR", "OCT_STR", + "BIN_STR", "REM", "QUOTEREM", "BANGREM", "BYE", "CLEAR", "CLR", "DATA", + "DEF", "DIM", "END", "EXIT", "FOR", "GET", "GOSUB", "GOTO", "IF", + "INPUT", "LET", "LIST", "NEXT", "NEW", "OF", "ON", "PRINT", "PUT", + "READ", "RETURN", "RUN", "STEP", "STOP", "THEN", "TO", "USING", "WAIT", + "OPEN", "CLOSE", "STATUS", "PRINT_FILE", "INPUT_FILE", "GET_FILE", + "PUT_FILE", "CALL", "CLS", "CMD", "OPTION", "BASE", "PEEK", "POKE", + "POP", "RANDOMIZE", "SYS", "VARLIST", "PAUSE", "SLEEP", "RESTORE", "ABS", + "SGN", "CLOG", "EXP", "LOG", "SQR", "PI", "RND", "INT", "FIX", "FRAC", + "ROUND", "CINT", "CSNG", "CDBL", "MOD", "MOD_INT", "DIV", "MAX", "MIN", + "COS", "SIN", "ATN", "ACS", "ASN", "TAN", "COSH", "SINH", "TANH", "ASC", + "LEFT", "MID", "RIGHT", "LEN", "STR", "VAL", "CHR", "SEG", "SUBSTR", + "INSTR", "INKEY", "AND", "OR", "NOT", "XOR", "EQV", "IMP", "CMP_LE", + "CMP_GE", "CMP_NE", "CMP_HASH", "ADR", "FRE", "SPC", "TAB", "POS", "USR", + "LIN", "TRAP", "RESUME", "ERROR", "RAISE", "ERR", "EL", "ER", "DEFSTR", + "DEFINT", "DEFSNG", "DEFDBL", "CHANGE", "CONVERT", "UCASE", "LCASE", + "STRNG", "TIME", "TIME_STR", "HEX", "OCT", "BIN", "HEXSTR", "OCTSTR", + "BINSTR", "UBOUND", "LBOUND", "LABEL", "MAT", "MATPRINT", "MATINPUT", + "MATREAD", "MATGET", "MATPUT", "MATZER", "MATCON", "MATIDN", "MATTRN", + "MATINV", "MATDET", "MATADD", "MATSUB", "MATMUL", "MATSCA", "MATFIL", + "'\\n'", "':'", "'='", "','", "';'", "'('", "')'", "'+'", "'-'", "'*'", + "'<'", "'>'", "'&'", "'/'", "'^'", "'['", "']'", "$accept", "program", + "line", "$@1", "statements", "statement", "expression", "expression0", + "binary_op", "expression1", "comparison_op", "expression2", "e2op", + "expression3", "term", "expression4", "unary_op", "function", "fn_0", + "fn_1", "fn_2", "fn_x", "factor", "user_function", "variable", + "printlist", "printsep", "exprlist", "slicelist", "varlist", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 10, 58, 61, 44, 59, 40, 41, 43, 45, 42, + 60, 62, 38, 47, 94, 91, 93 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 187, 188, 188, 188, 189, 190, 189, 191, 191, + 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 193, 194, 194, 195, + 195, 196, 196, 197, 197, 197, 197, 197, 197, 197, + 198, 198, 199, 199, 199, 200, 200, 201, 201, 201, + 201, 201, 201, 201, 202, 202, 203, 203, 204, 204, + 204, 204, 204, 204, 204, 204, 204, 204, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 207, 207, + 207, 207, 207, 207, 207, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208, 209, 209, + 209, 209, 209, 210, 211, 211, 211, 211, 211, 212, + 212, 212, 212, 212, 213, 213, 214, 214, 215, 215, + 216, 216 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 3, 3, 0, 0, 3, 1, 3, + 2, 2, 0, 1, 1, 1, 1, 2, 4, 4, + 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, + 2, 1, 2, 1, 6, 8, 2, 2, 2, 4, + 2, 2, 4, 2, 4, 4, 4, 2, 4, 2, + 1, 1, 4, 4, 4, 3, 1, 2, 4, 1, + 2, 5, 2, 2, 1, 2, 2, 2, 1, 2, + 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, + 3, 4, 2, 1, 1, 2, 3, 4, 6, 6, + 6, 8, 6, 3, 3, 3, 4, 7, 4, 4, + 7, 4, 7, 7, 9, 7, 1, 1, 3, 1, + 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, + 3, 4, 4, 6, 1, 4, 6, 8, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 4, 1, 4, 4, 4, 7, 0, + 1, 2, 1, 2, 1, 1, 1, 3, 3, 3, + 1, 3 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 5, 6, 0, 2, 12, 1, 0, 5, 214, 13, + 14, 15, 16, 20, 21, 0, 0, 0, 31, 33, + 0, 0, 0, 0, 0, 219, 0, 50, 51, 0, + 219, 0, 0, 73, 75, 0, 0, 22, 23, 0, + 0, 59, 64, 0, 84, 56, 68, 0, 83, 72, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 8, 0, 4, 3, 0, 0, 209, + 208, 0, 177, 157, 178, 163, 165, 174, 181, 150, + 151, 170, 166, 167, 200, 189, 188, 190, 191, 164, + 179, 159, 192, 197, 193, 172, 182, 184, 162, 198, + 199, 195, 148, 137, 158, 149, 180, 183, 196, 186, + 173, 187, 154, 155, 185, 171, 194, 152, 153, 168, + 175, 160, 169, 176, 161, 201, 202, 207, 203, 204, + 206, 205, 156, 0, 136, 226, 106, 107, 111, 120, + 125, 0, 134, 139, 0, 0, 144, 138, 211, 210, + 24, 0, 230, 30, 0, 36, 208, 38, 208, 41, + 0, 224, 225, 220, 43, 222, 0, 0, 49, 0, + 0, 0, 60, 62, 67, 74, 76, 85, 17, 0, + 0, 66, 65, 78, 57, 69, 79, 82, 70, 71, + 32, 63, 29, 27, 28, 26, 0, 0, 77, 0, + 47, 219, 219, 0, 0, 10, 11, 12, 0, 226, + 0, 0, 0, 0, 0, 109, 110, 0, 116, 117, + 118, 119, 113, 114, 115, 0, 122, 123, 124, 0, + 129, 130, 131, 132, 127, 128, 133, 0, 135, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12, 221, 223, 0, 0, 0, 0, 0, 0, 55, + 0, 0, 0, 80, 94, 93, 95, 0, 9, 86, + 0, 0, 215, 217, 216, 0, 212, 108, 112, 121, + 126, 140, 0, 0, 0, 0, 227, 25, 231, 0, + 39, 42, 45, 44, 46, 81, 48, 54, 53, 52, + 219, 58, 18, 19, 99, 96, 101, 0, 0, 98, + 0, 87, 229, 228, 0, 213, 141, 142, 0, 0, + 145, 0, 61, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 0, 0, 88, 89, 90, 92, 218, 143, 0, 146, + 0, 100, 97, 102, 105, 103, 0, 0, 35, 0, + 91, 147, 104 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 3, 4, 62, 63, 135, 136, 217, 137, + 225, 138, 229, 139, 237, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 164, 165, 150, 211, 153 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -196 +static const yytype_int16 yypact[] = +{ + 10, -196, 7, -196, 1779, -196, -144, 10, -156, -196, + -196, -196, -196, -196, -196, 1100, 31, 39, -196, -196, + 39, 39, 1225, 1350, 1100, 451, -2, 39, -196, 576, + 326, 1100, 39, 1100, 1100, 1100, 1100, -196, -196, 12, + 1100, -196, 725, 1100, -196, 1100, 1100, 1100, 1100, 850, + 1100, 1100, 39, 39, 39, 39, 39, 39, 1100, -118, + 39, 33, 49, -84, -72, -196, -196, 1100, 1100, -196, + -196, -95, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, 1100, -196, -196, 3, -57, -80, -41, + -196, 1475, -196, -54, -53, -50, -49, -196, -196, -196, + -66, -45, -196, -44, -42, -196, 20, 94, 24, 97, + 0, -196, -196, -196, 451, -196, -40, -39, -44, 107, + 93, 1100, 451, -196, -44, -196, -196, -66, -196, 1100, + -38, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -44, -44, -44, -44, 95, 96, -196, 1100, + -196, 451, 451, 39, -28, -196, -196, 1779, 1100, -35, + -158, -30, -91, 1100, -27, -196, -196, 1100, -196, -196, + -196, -196, -196, -196, -196, 1100, -196, -196, -196, 1100, + -196, -196, -196, -196, -196, -196, -196, 1100, -196, 975, + 1100, 1100, 1100, 1100, 1100, 39, 1100, 1100, 1100, 133, + 1638, -196, -196, 1100, 1100, 1100, 1100, 1100, -26, -196, + 1100, 39, 39, -196, 451, 451, -44, -6, 49, -196, + 1100, 1100, -25, -196, -196, -98, -196, -57, -80, -41, + -196, -196, -24, -17, -13, -92, -196, -196, -196, 101, + -66, -66, -196, -196, 49, -196, -196, -66, -66, -66, + 451, -196, -196, -196, -12, -11, -10, -9, -8, -196, + 1100, -61, -196, -196, 1100, -196, -196, -196, 1100, 1100, + -196, 1100, 451, 1100, 1100, 1100, 39, 39, -14, 39, + 39, 39, -35, -5, -1, -77, 106, -68, -67, -62, + 2, 4, 5, -196, -196, -196, -196, -196, 1100, -196, + 1100, -196, -196, -196, -196, -3, 39, 9, -196, 39, + -196, -196, -196 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -196, -196, 144, -196, -195, -196, 43, -196, -196, -43, + -196, -46, -196, -37, -196, -69, -196, 42, -196, -196, + -196, -196, -196, 170, -4, -29, -161, -31, -127, -22 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -41 +static const yytype_int16 yytable[] = +{ + 64, 172, 8, 252, 177, 168, 8, 5, 6, 270, + 174, 252, 268, 152, 1, 243, 154, 155, 272, 67, + -37, -37, 167, 152, -40, -40, 65, 249, 152, 68, + 192, 193, 194, 195, -37, -37, 210, 212, -40, -40, + 71, 8, 230, 250, 231, 232, 233, 8, 152, 152, + 152, 152, 196, 197, 199, 294, 200, 204, 218, 219, + 220, 221, 201, 205, 206, 157, 159, 160, 163, 202, + 179, 203, 170, 163, 173, 243, 175, 176, 315, 178, + 213, 319, 243, 180, 320, 182, 183, 207, 184, 185, + 186, 187, 189, 190, 191, 274, 348, 226, 227, 349, + 208, 198, 228, 252, 252, 243, 243, 243, 351, 352, + 209, 243, 215, 216, 353, 222, 329, 330, 331, 256, + 257, 239, 240, 223, 224, 241, 242, 244, 247, 245, + 246, 248, 253, 254, 255, 260, 271, 292, 234, 261, + 262, 166, 235, 236, 267, 321, 273, 350, 300, 276, + 314, 66, 316, 304, 305, 306, 307, 308, 309, 317, + 318, 252, 342, 323, 324, 325, 326, 327, 280, 310, + 359, 346, 264, 265, 277, 347, 214, 7, 354, 278, + 355, 266, 275, 238, 356, 361, 151, 333, 0, 0, + -37, -37, 279, 0, -40, -40, 0, 0, 0, 152, + 0, 0, 0, 64, 0, 0, 0, 251, 0, 0, + 0, 0, 0, 0, 258, 251, 290, 291, 0, 0, + 0, 0, 259, 0, 297, 298, 299, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 288, 263, 0, 163, 163, 64, 0, 0, 0, + 0, 269, 0, 0, 0, 0, 0, 302, 303, 0, + 0, 0, 0, 311, 0, 0, 0, 0, 0, 0, + 0, 322, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 282, 283, 284, 285, 286, 287, 0, 289, + 0, 0, 337, 338, 339, 0, 295, 296, 0, 0, + 0, 0, 0, 301, 0, 0, 0, 251, 251, 0, + 0, 0, 0, 312, 313, 0, 0, 0, 0, 0, + 0, 0, 340, 341, 0, 343, 344, 345, 0, 69, + 70, 0, 0, 0, 8, 71, 0, 0, 0, 0, + 0, 0, 0, 163, 0, 0, 0, 0, 0, 0, + 0, 0, 360, 328, 0, 362, 0, 332, 0, 0, + 0, 334, 335, 0, 336, 251, 0, 0, 0, 0, + 0, 171, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, + 0, 357, 0, 358, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 0, 0, 0, 85, + 0, 86, 87, 88, 89, 90, 91, 0, 0, 0, + 0, 0, 0, 0, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 0, 0, 103, 0, 0, + 0, 0, 0, 0, 0, 104, 105, 106, 107, 108, + 109, 110, 0, 0, 69, 70, 111, 112, 113, 8, + 71, 0, 0, 0, 0, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 0, 0, + 0, 0, 0, 0, 0, 127, 128, 129, 130, 131, + 132, 0, 0, 0, 0, 0, 0, 0, 0, 161, + 162, 133, 0, 0, 134, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 0, 0, 0, 85, 0, 86, 87, 88, 89, + 90, 91, 0, 0, 0, 0, 0, 0, 0, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, + 104, 105, 106, 107, 108, 109, 110, 0, 0, 69, + 70, 111, 112, 113, 8, 71, 0, 0, 0, 0, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 0, 0, 0, 0, 0, 0, 0, + 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 161, 162, 133, 0, 0, 134, + 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, + 0, 0, 0, 0, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 0, 0, 0, 85, + 0, 86, 87, 88, 89, 90, 91, 0, 0, 0, + 0, 0, 0, 0, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 0, 0, 103, 0, 0, + 0, 0, 0, 0, 0, 104, 105, 106, 107, 108, + 109, 110, 0, 0, 169, 0, 111, 112, 113, 0, + 0, 0, 0, 0, 0, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 69, 70, + 0, 0, 0, 8, 71, 127, 128, 129, 130, 131, + 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 0, 0, 181, 0, 0, + 0, 0, 0, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 0, 0, 0, 85, 0, + 86, 87, 88, 89, 90, 91, 0, 0, 0, 0, + 0, 0, 0, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 0, 0, 103, 0, 0, 0, + 0, 0, 0, 0, 104, 105, 106, 107, 108, 109, + 110, 0, 0, 69, 70, 111, 112, 113, 8, 71, + 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 0, 0, + 0, 0, 188, 0, 127, 128, 129, 130, 131, 132, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 133, 0, 0, 134, 0, 0, 0, 0, 0, 72, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 0, 0, 0, 85, 0, 86, 87, 88, 89, 90, + 91, 0, 0, 0, 0, 0, 0, 0, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, + 0, 103, 0, 0, 0, 0, 0, 0, 0, 104, + 105, 106, 107, 108, 109, 110, 0, 0, 69, 70, + 111, 112, 113, 8, 71, 0, 0, 0, 0, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 0, 0, 0, 0, 0, 0, 127, + 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, + 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, + 0, 0, 0, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 0, 0, 0, 85, 0, + 86, 87, 88, 89, 90, 91, 0, 0, 0, 0, + 0, 0, 0, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 0, 0, 103, 0, 0, 0, + 0, 0, 0, 0, 104, 105, 106, 107, 108, 109, + 110, 0, 0, 69, 70, 111, 112, 113, 8, 71, + 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 0, 0, + 0, 0, 0, 0, 127, 128, 129, 130, 131, 132, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 133, 281, 0, 134, 0, 0, 0, 0, 0, 72, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 0, 0, 0, 85, 0, 86, 87, 88, 89, 90, + 91, 0, 0, 0, 0, 0, 0, 0, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, + 0, 103, 0, 0, 0, 0, 0, 0, 0, 104, + 105, 106, 107, 108, 109, 110, 0, 0, 69, 156, + 111, 112, 113, 8, 71, 0, 0, 0, 0, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 0, 0, 0, 0, 0, 0, 127, + 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, + 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, + 0, 0, 0, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 0, 0, 0, 85, 0, + 86, 87, 88, 89, 90, 91, 0, 0, 0, 0, + 0, 0, 0, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 0, 0, 103, 0, 0, 0, + 0, 0, 0, 0, 104, 105, 106, 107, 108, 109, + 110, 0, 0, 69, 158, 111, 112, 113, 8, 71, + 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 0, 0, + 0, 0, 0, 0, 127, 128, 129, 130, 131, 132, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 133, 0, 0, 134, 0, 0, 0, 0, 0, 72, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 0, 0, 0, 85, 0, 86, 87, 88, 89, 90, + 91, 0, 0, 0, 0, 0, 0, 0, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, + 0, 103, 0, 0, 0, 0, 0, 0, 0, 104, + 105, 106, 107, 108, 109, 110, 0, 0, 69, 70, + 111, 112, 113, 8, 71, 0, 0, 0, 0, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 0, 0, 0, 0, 0, 0, 127, + 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, + 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, + 0, 0, 0, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 0, 0, 0, 85, 0, + 86, 87, 88, 89, 90, 91, 0, 0, 0, 0, + 0, 0, 0, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 104, 105, 106, 107, 108, 109, + 110, 0, 0, 0, 0, 111, 112, 113, 0, 0, + 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 0, 0, + 0, 0, 0, 0, 127, 128, 129, 130, 131, 132, + 0, 0, 293, 0, 0, 0, 8, 0, 0, 0, + 133, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, + 27, 28, 0, 29, 30, 31, 32, 33, 0, 0, + 34, 0, 0, 0, 35, 0, 0, 0, 0, 0, + 0, 0, 36, 37, 38, 39, 0, 0, 40, 41, + 42, 43, 44, 45, 0, 46, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 47, 0, 0, 0, 48, 49, 50, 51, 0, 0, + 0, 52, 53, 54, 55, 56, 57, 0, 0, 58, + 0, 59, 0, 0, 0, 0, 0, 8, 0, 0, + 60, 61, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 0, 27, 28, 0, 29, 30, 31, 32, 33, 0, + 0, 34, 0, 0, 0, 35, 0, 0, 0, 0, + 0, 0, 0, 36, 37, 38, 39, 0, 0, 40, + 41, 42, 43, 44, 45, 0, 46, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 47, 0, 0, 0, 48, 49, 50, 51, 0, + 0, 0, 52, 53, 54, 55, 56, 57, 0, 0, + 58, 0, 59, 0, 0, 0, 0, 0, 0, 0, + 0, 60, 61 +}; + +static const yytype_int16 yycheck[] = +{ + 4, 30, 8, 164, 35, 27, 8, 0, 1, 44, + 32, 172, 207, 17, 4, 173, 20, 21, 176, 175, + 0, 1, 26, 27, 0, 1, 170, 27, 32, 185, + 52, 53, 54, 55, 14, 15, 67, 68, 14, 15, + 9, 8, 83, 43, 85, 86, 87, 8, 52, 53, + 54, 55, 56, 57, 172, 250, 60, 61, 115, 116, + 117, 118, 29, 14, 15, 22, 23, 24, 25, 36, + 58, 38, 29, 30, 31, 173, 33, 34, 176, 36, + 175, 173, 173, 40, 176, 42, 43, 171, 45, 46, + 47, 48, 49, 50, 51, 186, 173, 177, 178, 176, + 172, 58, 182, 264, 265, 173, 173, 173, 176, 176, + 67, 173, 109, 110, 176, 172, 177, 178, 179, 26, + 27, 175, 175, 180, 181, 175, 175, 172, 34, 173, + 172, 34, 172, 172, 27, 173, 171, 4, 179, 44, + 44, 143, 183, 184, 172, 44, 176, 41, 174, 176, + 175, 7, 176, 159, 160, 161, 162, 163, 164, 176, + 173, 322, 176, 175, 175, 175, 175, 175, 237, 175, + 173, 176, 201, 202, 217, 176, 133, 170, 176, 225, + 176, 203, 213, 141, 179, 176, 16, 314, -1, -1, + 170, 171, 229, -1, 170, 171, -1, -1, -1, 203, + -1, -1, -1, 207, -1, -1, -1, 164, -1, -1, + -1, -1, -1, -1, 171, 172, 247, 248, -1, -1, + -1, -1, 179, -1, 255, 256, 257, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 245, 199, -1, 201, 202, 250, -1, -1, -1, + -1, 208, -1, -1, -1, -1, -1, 261, 262, -1, + -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, + -1, 300, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 239, 240, 241, 242, 243, 244, -1, 246, + -1, -1, 323, 324, 325, -1, 253, 254, -1, -1, + -1, -1, -1, 260, -1, -1, -1, 264, 265, -1, + -1, -1, -1, 270, 271, -1, -1, -1, -1, -1, + -1, -1, 326, 327, -1, 329, 330, 331, -1, 3, + 4, -1, -1, -1, 8, 9, -1, -1, -1, -1, + -1, -1, -1, 300, -1, -1, -1, -1, -1, -1, + -1, -1, 356, 310, -1, 359, -1, 314, -1, -1, + -1, 318, 319, -1, 321, 322, -1, -1, -1, -1, + -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, 348, -1, 350, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, -1, -1, -1, 83, + -1, 85, 86, 87, 88, 89, 90, -1, -1, -1, + -1, -1, -1, -1, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, -1, -1, 111, -1, -1, + -1, -1, -1, -1, -1, 119, 120, 121, 122, 123, + 124, 125, -1, -1, 3, 4, 130, 131, 132, 8, + 9, -1, -1, -1, -1, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, -1, -1, + -1, -1, -1, -1, -1, 159, 160, 161, 162, 163, + 164, -1, -1, -1, -1, -1, -1, -1, -1, 173, + 174, 175, -1, -1, 178, -1, -1, -1, -1, -1, + 59, -1, -1, -1, -1, -1, -1, -1, -1, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, -1, -1, -1, 83, -1, 85, 86, 87, 88, + 89, 90, -1, -1, -1, -1, -1, -1, -1, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, + 119, 120, 121, 122, 123, 124, 125, -1, -1, 3, + 4, 130, 131, 132, 8, 9, -1, -1, -1, -1, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, -1, -1, -1, -1, -1, -1, -1, + 159, 160, 161, 162, 163, 164, -1, -1, -1, -1, + -1, -1, -1, -1, 173, 174, 175, -1, -1, 178, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, -1, -1, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, -1, -1, -1, 83, + -1, 85, 86, 87, 88, 89, 90, -1, -1, -1, + -1, -1, -1, -1, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, -1, -1, 111, -1, -1, + -1, -1, -1, -1, -1, 119, 120, 121, 122, 123, + 124, 125, -1, -1, 128, -1, 130, 131, 132, -1, + -1, -1, -1, -1, -1, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 3, 4, + -1, -1, -1, 8, 9, 159, 160, 161, 162, 163, + 164, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 175, -1, -1, 178, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, -1, -1, 62, -1, -1, + -1, -1, -1, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, -1, -1, -1, 83, -1, + 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, + -1, -1, -1, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, -1, -1, 111, -1, -1, -1, + -1, -1, -1, -1, 119, 120, 121, 122, 123, 124, + 125, -1, -1, 3, 4, 130, 131, 132, 8, 9, + -1, -1, -1, -1, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, -1, -1, -1, + -1, -1, 32, -1, 159, 160, 161, 162, 163, 164, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 175, -1, -1, 178, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + -1, -1, -1, 83, -1, 85, 86, 87, 88, 89, + 90, -1, -1, -1, -1, -1, -1, -1, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, -1, + -1, 111, -1, -1, -1, -1, -1, -1, -1, 119, + 120, 121, 122, 123, 124, 125, -1, -1, 3, 4, + 130, 131, 132, 8, 9, -1, -1, -1, -1, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, -1, -1, -1, -1, -1, -1, -1, 159, + 160, 161, 162, 163, 164, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 175, -1, -1, 178, -1, + -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, + -1, -1, -1, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, -1, -1, -1, 83, -1, + 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, + -1, -1, -1, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, -1, -1, 111, -1, -1, -1, + -1, -1, -1, -1, 119, 120, 121, 122, 123, 124, + 125, -1, -1, 3, 4, 130, 131, 132, 8, 9, + -1, -1, -1, -1, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, -1, -1, -1, + -1, -1, -1, -1, 159, 160, 161, 162, 163, 164, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 175, 176, -1, 178, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + -1, -1, -1, 83, -1, 85, 86, 87, 88, 89, + 90, -1, -1, -1, -1, -1, -1, -1, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, -1, + -1, 111, -1, -1, -1, -1, -1, -1, -1, 119, + 120, 121, 122, 123, 124, 125, -1, -1, 3, 4, + 130, 131, 132, 8, 9, -1, -1, -1, -1, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, -1, -1, -1, -1, -1, -1, -1, 159, + 160, 161, 162, 163, 164, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 175, -1, -1, 178, -1, + -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, + -1, -1, -1, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, -1, -1, -1, 83, -1, + 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, + -1, -1, -1, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, -1, -1, 111, -1, -1, -1, + -1, -1, -1, -1, 119, 120, 121, 122, 123, 124, + 125, -1, -1, 3, 4, 130, 131, 132, 8, 9, + -1, -1, -1, -1, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, -1, -1, -1, + -1, -1, -1, -1, 159, 160, 161, 162, 163, 164, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 175, -1, -1, 178, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + -1, -1, -1, 83, -1, 85, 86, 87, 88, 89, + 90, -1, -1, -1, -1, -1, -1, -1, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, -1, + -1, 111, -1, -1, -1, -1, -1, -1, -1, 119, + 120, 121, 122, 123, 124, 125, -1, -1, 3, 4, + 130, 131, 132, 8, 9, -1, -1, -1, -1, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, -1, -1, -1, -1, -1, -1, -1, 159, + 160, 161, 162, 163, 164, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 175, -1, -1, 178, -1, + -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, + -1, -1, -1, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, -1, -1, -1, 83, -1, + 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, + -1, -1, -1, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 119, 120, 121, 122, 123, 124, + 125, -1, -1, -1, -1, 130, 131, 132, -1, -1, + -1, -1, -1, -1, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, -1, -1, -1, + -1, -1, -1, -1, 159, 160, 161, 162, 163, 164, + -1, -1, 4, -1, -1, -1, 8, -1, -1, -1, + 175, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, + 32, 33, -1, 35, 36, 37, 38, 39, -1, -1, + 42, -1, -1, -1, 46, -1, -1, -1, -1, -1, + -1, -1, 54, 55, 56, 57, -1, -1, 60, 61, + 62, 63, 64, 65, -1, 67, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 122, -1, -1, -1, 126, 127, 128, 129, -1, -1, + -1, 133, 134, 135, 136, 137, 138, -1, -1, 141, + -1, 143, -1, -1, -1, -1, -1, 8, -1, -1, + 152, 153, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + -1, 32, 33, -1, 35, 36, 37, 38, 39, -1, + -1, 42, -1, -1, -1, 46, -1, -1, -1, -1, + -1, -1, -1, 54, 55, 56, 57, -1, -1, 60, + 61, 62, 63, 64, 65, -1, 67, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 122, -1, -1, -1, 126, 127, 128, 129, -1, + -1, -1, 133, 134, 135, 136, 137, 138, -1, -1, + 141, -1, 143, -1, -1, -1, -1, -1, -1, -1, + -1, 152, 153 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 4, 188, 189, 190, 0, 1, 170, 8, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 32, 33, 35, + 36, 37, 38, 39, 42, 46, 54, 55, 56, 57, + 60, 61, 62, 63, 64, 65, 67, 122, 126, 127, + 128, 129, 133, 134, 135, 136, 137, 138, 141, 143, + 152, 153, 191, 192, 211, 170, 189, 175, 185, 3, + 4, 9, 59, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 83, 85, 86, 87, 88, + 89, 90, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 111, 119, 120, 121, 122, 123, 124, + 125, 130, 131, 132, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 159, 160, 161, + 162, 163, 164, 175, 178, 193, 194, 196, 198, 200, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 214, 210, 211, 216, 211, 211, 4, 193, 4, 193, + 193, 173, 174, 193, 212, 213, 143, 211, 216, 128, + 193, 45, 212, 193, 216, 193, 193, 214, 193, 58, + 193, 62, 193, 193, 193, 193, 193, 193, 32, 193, + 193, 193, 216, 216, 216, 216, 211, 211, 193, 172, + 211, 29, 36, 38, 211, 14, 15, 171, 172, 193, + 214, 215, 214, 175, 193, 109, 110, 195, 115, 116, + 117, 118, 172, 180, 181, 197, 177, 178, 182, 199, + 83, 85, 86, 87, 179, 183, 184, 201, 204, 175, + 175, 175, 175, 173, 172, 173, 172, 34, 34, 27, + 43, 193, 213, 172, 172, 27, 26, 27, 193, 193, + 173, 44, 44, 193, 212, 212, 216, 172, 191, 193, + 44, 171, 176, 176, 186, 214, 176, 196, 198, 200, + 202, 176, 193, 193, 193, 193, 193, 193, 211, 193, + 214, 214, 4, 4, 191, 193, 193, 214, 214, 214, + 174, 193, 211, 211, 159, 160, 161, 162, 163, 164, + 175, 211, 193, 193, 175, 176, 176, 176, 173, 173, + 176, 44, 212, 175, 175, 175, 175, 175, 193, 177, + 178, 179, 193, 215, 193, 193, 193, 214, 214, 214, + 211, 211, 176, 211, 211, 211, 176, 176, 173, 176, + 41, 176, 176, 176, 176, 176, 179, 193, 193, 173, + 211, 176, 211 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 5: + +/* Line 1455 of yacc.c */ +#line 264 "parse.y" + { + ;} + break; + + case 6: + +/* Line 1455 of yacc.c */ +#line 268 "parse.y" + { errline = (yyvsp[(1) - (1)].d); ;} + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 269 "parse.y" + { + interpreter_state.lines[(int)(yyvsp[(1) - (3)].d)] = (yyvsp[(3) - (3)].l); + ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 276 "parse.y" + { + (yyval.l) = lst_prepend(NULL, (yyvsp[(1) - (1)].statement)); + ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 281 "parse.y" + { + (yyval.l) = lst_prepend((yyvsp[(3) - (3)].l), (yyvsp[(1) - (3)].statement)); + ;} + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 286 "parse.y" + { + (yyval.l) = lst_prepend((yyvsp[(1) - (2)].l), NULL); + ;} + break; + + case 11: + +/* Line 1455 of yacc.c */ +#line 291 "parse.y" + { + (yyval.l) = lst_prepend((yyvsp[(1) - (2)].l), NULL); + ;} + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 299 "parse.y" + { + (yyval.statement) = NULL; + ;} + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 304 "parse.y" + { + statement_t *new = make_statement(REM); + new->parms.rem = yylval.s; // the string has been modified in scan to remove the REM + (yyval.statement) = new; + ;} + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 311 "parse.y" + { + statement_t *new = make_statement(QUOTEREM); + new->parms.rem = yylval.s; + (yyval.statement) = new; + ;} + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 318 "parse.y" + { + statement_t *new = make_statement(BANGREM); + new->parms.rem = yylval.s; + (yyval.statement) = new; + ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 325 "parse.y" + { + statement_t *new = make_statement(BYE); + (yyval.statement) = new; + ;} + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 331 "parse.y" + { + statement_t *new = make_statement(CALL); + (yyval.statement) = new; + ;} + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 337 "parse.y" + { + statement_t *new = make_statement(CHANGE); + new->parms.change.var1 = (yyvsp[(2) - (4)].variable); + new->parms.change.var2 = (yyvsp[(4) - (4)].variable); + (yyval.statement) = new; + ;} + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 345 "parse.y" + { + statement_t *new = make_statement(CONVERT); + new->parms.change.var1 = (yyvsp[(2) - (4)].variable); + new->parms.change.var2 = (yyvsp[(4) - (4)].variable); + (yyval.statement) = new; + ;} + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 353 "parse.y" + { + statement_t *new = make_statement(CLEAR); + (yyval.statement) = new; + ;} + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 359 "parse.y" + { + statement_t *new = make_statement(CLEAR); + (yyval.statement) = new; + ;} + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 365 "parse.y" + { + statement_t *new = make_statement(CLS); + (yyval.statement) = new; + ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 371 "parse.y" + { + statement_t *new = make_statement(CMD); + (yyval.statement) = new; + ;} + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 377 "parse.y" + { + statement_t *new = make_statement(DATA); + new->parms.data = (yyvsp[(2) - (2)].l); + (yyval.statement) = new; + ;} + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 384 "parse.y" + { + statement_t *new = make_statement(DEF); + new->parms.def.signature = (yyvsp[(2) - (4)].variable); + new->parms.def.formula = (yyvsp[(4) - (4)].expression); + (yyval.statement) = new; + ;} + break; + + case 26: + +/* Line 1455 of yacc.c */ +#line 392 "parse.y" + { + statement_t *new = make_statement(DEFSTR); + new->parms.deftype.vars = (yyvsp[(2) - (2)].l); + new->parms.deftype.type = DOUBLE; + (yyval.statement) = new; + ;} + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 400 "parse.y" + { + statement_t *new = make_statement(DEFSTR); + new->parms.deftype.vars = (yyvsp[(2) - (2)].l); + new->parms.deftype.type = INTEGER; + (yyval.statement) = new; + ;} + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 408 "parse.y" + { + statement_t *new = make_statement(DEFSTR); + new->parms.deftype.vars = (yyvsp[(2) - (2)].l); + new->parms.deftype.type = SINGLE; + (yyval.statement) = new; + ;} + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 416 "parse.y" + { + statement_t *new = make_statement(DEFSTR); + new->parms.deftype.vars = (yyvsp[(2) - (2)].l); + new->parms.deftype.type = STRING; + (yyval.statement) = new; + ;} + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 424 "parse.y" + { + statement_t *new = make_statement(DIM); + new->parms.dim = (yyvsp[(2) - (2)].l); + (yyval.statement) = new; + ;} + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 431 "parse.y" + { + statement_t *new = make_statement(END); + (yyval.statement) = new; + ;} + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 437 "parse.y" + { + statement_t *new = make_statement(RAISE); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 444 "parse.y" + { + statement_t *new = make_statement(EXIT); + (yyval.statement) = new; + ;} + break; + + case 34: + +/* Line 1455 of yacc.c */ +#line 450 "parse.y" + { + statement_t *new = make_statement(FOR); + new->parms._for.variable = (yyvsp[(2) - (6)].variable); + new->parms._for.begin = (yyvsp[(4) - (6)].expression); + new->parms._for.end = (yyvsp[(6) - (6)].expression); + new->parms._for.step = NULL; + (yyval.statement) = new; + + /* static analyser */ + for_loops_total++; + for_loops_step_1++; + ;} + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 464 "parse.y" + { + statement_t *new = make_statement(FOR); + new->parms._for.variable = (yyvsp[(2) - (8)].variable); + new->parms._for.begin = (yyvsp[(4) - (8)].expression); + new->parms._for.end = (yyvsp[(6) - (8)].expression); + new->parms._for.step = (yyvsp[(8) - (8)].expression); + (yyval.statement) = new; + + /* static analyser - consider anything with a STEP special even if it is a 1 */ + for_loops_total++; + ;} + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 477 "parse.y" + { + statement_t *new = make_statement(GET); + new->parms.generic_variable = (yyvsp[(2) - (2)].variable); + (yyval.statement) = new; + ;} + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 484 "parse.y" + { + statement_t *new = make_statement(GOSUB); + expression_t *exp = make_expression(number); + exp->parms.number = (yyvsp[(2) - (2)].d); + new->parms._goto = exp; + (yyval.statement) = new; + + /* static analyzer */ + linenum_gosub_totals++; + linenum_constants_total++; + if ((yyvsp[(2) - (2)].d) == errline) { + linenum_same_line++; + } else if ((yyvsp[(2) - (2)].d) > errline) { + linenum_forwards++; + } else { + linenum_backwards++; + } + ;} + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 504 "parse.y" + { + statement_t *new = make_statement(GOSUB); + new->parms.gosub = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + + /* static analyzer */ + linenum_gosub_totals++; + linenum_constants_total++; + if ((yyvsp[(2) - (2)].expression)->parms.number) { + if ((yyvsp[(2) - (2)].expression)->parms.number == errline) { + linenum_same_line++; + } else if ((yyvsp[(2) - (2)].expression)->parms.number > errline) { + linenum_forwards++; + } else { + linenum_backwards++; + } + } + ;} + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 524 "parse.y" + { + statement_t *new = make_statement(OF); + new->parms.on.type = GOSUB; + new->parms.on.expression = (yyvsp[(2) - (4)].expression); + new->parms.on.numbers = (yyvsp[(4) - (4)].l); + (yyval.statement) = new; + + linenum_constants_total += lst_length((yyvsp[(4) - (4)].l)); + linenum_on_totals++; + ;} + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 536 "parse.y" + { + statement_t *new = make_statement(GOTO); + expression_t *exp = make_expression(number); + exp->parms.number = (yyvsp[(2) - (2)].d); + new->parms._goto = exp; + (yyval.statement) = new; + + /* static analyzer */ + linenum_goto_totals++; + linenum_constants_total++; + if ((yyvsp[(2) - (2)].d) == errline) { + linenum_same_line++; + } else if ((yyvsp[(2) - (2)].d) > errline) { + linenum_forwards++; + } else { + linenum_backwards++; + } + ;} + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 556 "parse.y" + { + statement_t *new = make_statement(GOTO); + new->parms._goto = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + + /* static analyzer */ + linenum_goto_totals++; + linenum_constants_total++; + if ((yyvsp[(2) - (2)].expression)->parms.number) { + if ((yyvsp[(2) - (2)].expression)->parms.number == errline) { + linenum_same_line++; + } else if ((yyvsp[(2) - (2)].expression)->parms.number > errline) { + linenum_forwards++; + } else { + linenum_backwards++; + } + } + ;} + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 576 "parse.y" + { + statement_t *new = make_statement(OF); + new->parms.on.type = GOTO; + new->parms.on.expression = (yyvsp[(2) - (4)].expression); + new->parms.on.numbers = (yyvsp[(4) - (4)].l); + (yyval.statement) = new; + + linenum_constants_total += lst_length((yyvsp[(4) - (4)].l)); + linenum_on_totals++; + ;} + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 588 "parse.y" + { + statement_t *new = make_statement(INPUT); + new->parms.input = (yyvsp[(2) - (2)].l); + (yyval.statement) = new; + ;} + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 595 "parse.y" + { + statement_t *new = make_statement(IF); + new->parms._if.condition = (yyvsp[(2) - (4)].expression); + new->parms._if.then_expression = NULL; + new->parms._if.then_linenumber = (yyvsp[(4) - (4)].d); + (yyval.statement) = new; + + /* static analyzer */ + // this handles the implicit GOTO case, GOSUBs are always explicit so they are caught in the THEN statements + linenum_then_goto_totals++; + linenum_constants_total++; + if ((yyvsp[(2) - (4)].expression)->parms.number) { + if ((yyvsp[(2) - (4)].expression)->parms.number == errline) { + linenum_same_line++; + } else if ((yyvsp[(2) - (4)].expression)->parms.number > errline) { + linenum_forwards++; + } else { + linenum_backwards++; + } + } + ;} + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 618 "parse.y" + { + statement_t *new = make_statement(IF); + new->parms._if.condition = (yyvsp[(2) - (4)].expression); + new->parms._if.then_expression = NULL; + new->parms._if.then_linenumber = (yyvsp[(4) - (4)].d); + (yyval.statement) = new; + + /* static analyzer */ + linenum_then_goto_totals++; + linenum_constants_total++; + if ((yyvsp[(2) - (4)].expression)->parms.number == errline) { + linenum_same_line++; + } else if ((yyvsp[(2) - (4)].expression)->parms.number > errline) { + linenum_forwards++; + } else { + linenum_backwards++; + } + ;} + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 638 "parse.y" + { + statement_t *new = make_statement(IF); + new->parms._if.condition = (yyvsp[(2) - (4)].expression); + new->parms._if.then_expression = (yyvsp[(4) - (4)].l); + new->parms._if.then_linenumber = 0; + (yyval.statement) = new; + ;} + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 647 "parse.y" + { + statement_t *new = make_statement(LABEL); + new->parms.label.variable = (yyvsp[(2) - (2)].variable); + new->parms.label.linenumber = errline; + (yyval.statement) = new; + ;} + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 655 "parse.y" + { + statement_t *new = make_statement(LET); + new->parms.let.variable = (yyvsp[(2) - (4)].variable); + new->parms.let.expression = (yyvsp[(4) - (4)].expression); + (yyval.statement) = new; + + /* static analyser - see if we are setting a value to 0 or 1 */ + //NOTE: same code below in invisible LET + if (new->parms.let.expression->type == number) { + if ((int)new->parms.let.expression->parms.number == 0) { + assign_zero++; + } else if ((int)new->parms.let.expression->parms.number == 1 + && (int)new->parms.let.expression->parms.number == new->parms.let.expression->parms.number) { + assign_one++; + } else { + assign_other++; + } + } + ;} + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 676 "parse.y" + { + statement_t *new = make_statement(NEXT); + new->parms.next = (yyvsp[(2) - (2)].l); + (yyval.statement) = new; + ;} + break; + + case 50: + +/* Line 1455 of yacc.c */ +#line 683 "parse.y" + { + statement_t *new = make_statement(NEXT); + new->parms.next = NULL; + (yyval.statement) = new; + ;} + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 690 "parse.y" + { + statement_t *new = make_statement(NEW); + new->parms.next = NULL; + (yyval.statement) = new; + ;} + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 697 "parse.y" + { + statement_t *new = make_statement(ON); + new->parms.on.type = GOTO; + new->parms.on.expression = (yyvsp[(2) - (4)].expression); + new->parms.on.numbers = (yyvsp[(4) - (4)].l); + (yyval.statement) = new; + + linenum_constants_total += lst_length((yyvsp[(4) - (4)].l)); + linenum_on_totals++; + ;} + break; + + case 53: + +/* Line 1455 of yacc.c */ +#line 709 "parse.y" + { + statement_t *new = make_statement(ON); + new->parms.on.type = GOSUB; + new->parms.on.expression = (yyvsp[(2) - (4)].expression); + new->parms.on.numbers = (yyvsp[(4) - (4)].l); + (yyval.statement) = new; + + linenum_constants_total += lst_length((yyvsp[(4) - (4)].l)); + linenum_on_totals++; + ;} + break; + + case 54: + +/* Line 1455 of yacc.c */ +#line 721 "parse.y" + { + statement_t *new = make_statement(ON); + new->parms.on.type = TRAP; + new->parms.on.numbers = (yyvsp[(4) - (4)].l); + (yyval.statement) = new; + + linenum_constants_total += lst_length((yyvsp[(4) - (4)].l)); + linenum_on_totals++; + ;} + break; + + case 55: + +/* Line 1455 of yacc.c */ +#line 732 "parse.y" + { + statement_t *new = make_statement(OPTION); + new->parms.generic_parameter = (yyvsp[(3) - (3)].expression); + (yyval.statement) = new; + ;} + break; + + case 56: + +/* Line 1455 of yacc.c */ +#line 739 "parse.y" + { + statement_t *new = make_statement(PAUSE); + (yyval.statement) = new; + ;} + break; + + case 57: + +/* Line 1455 of yacc.c */ +#line 745 "parse.y" + { + statement_t *new = make_statement(PAUSE); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 58: + +/* Line 1455 of yacc.c */ +#line 752 "parse.y" + { + statement_t *new = make_statement(POKE); + new->parms.generic_parameter = (yyvsp[(2) - (4)].expression); + new->parms.generic_parameter2 = (yyvsp[(4) - (4)].expression); + (yyval.statement) = new; + ;} + break; + + case 59: + +/* Line 1455 of yacc.c */ +#line 760 "parse.y" + { + statement_t *new = make_statement(POP); + (yyval.statement) = new; + ;} + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 766 "parse.y" + { + statement_t *new = make_statement(PRINT); + new->parms.print.format = NULL; + new->parms.print.item_list = (yyvsp[(2) - (2)].l); + (yyval.statement) = new; + ;} + break; + + case 61: + +/* Line 1455 of yacc.c */ +#line 774 "parse.y" + { + statement_t *new = make_statement(PRINT); + new->parms.print.format = (yyvsp[(3) - (5)].expression); + new->parms.print.item_list = (yyvsp[(5) - (5)].l); + (yyval.statement) = new; + ;} + break; + + case 62: + +/* Line 1455 of yacc.c */ +#line 782 "parse.y" + { + statement_t *new = make_statement(PUT); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 63: + +/* Line 1455 of yacc.c */ +#line 789 "parse.y" + { + statement_t *new = make_statement(RAISE); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 64: + +/* Line 1455 of yacc.c */ +#line 796 "parse.y" + { + statement_t *new = make_statement(RANDOMIZE); + new->parms.generic_parameter = NULL; + (yyval.statement) = new; + ;} + break; + + case 65: + +/* Line 1455 of yacc.c */ +#line 803 "parse.y" + { + statement_t *new = make_statement(RANDOMIZE); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 66: + +/* Line 1455 of yacc.c */ +#line 810 "parse.y" + { + // this handles RANDOMIZE TIMER because scan converts TIMER to RANDOMIZE + statement_t *new = make_statement(RANDOMIZE); + new->parms.generic_parameter = NULL; + (yyval.statement) = new; + ;} + break; + + case 67: + +/* Line 1455 of yacc.c */ +#line 818 "parse.y" + { + statement_t *new = make_statement(READ); + new->parms.read = (yyvsp[(2) - (2)].l); + (yyval.statement) = new; + ;} + break; + + case 68: + +/* Line 1455 of yacc.c */ +#line 825 "parse.y" + { + statement_t *new = make_statement(RESTORE); + (yyval.statement) = new; + ;} + break; + + case 69: + +/* Line 1455 of yacc.c */ +#line 831 "parse.y" + { + statement_t *new = make_statement(RESTORE); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 70: + +/* Line 1455 of yacc.c */ +#line 838 "parse.y" + { + statement_t *new = make_statement(RESUME); + expression_t *exp = make_expression(number); + exp->parms.number = -1; + new->parms.generic_parameter = exp; + (yyval.statement) = new; + ;} + break; + + case 71: + +/* Line 1455 of yacc.c */ +#line 847 "parse.y" + { + statement_t *new = make_statement(RESUME); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 72: + +/* Line 1455 of yacc.c */ +#line 854 "parse.y" + { + statement_t *new = make_statement(RESUME); + (yyval.statement) = new; + ;} + break; + + case 73: + +/* Line 1455 of yacc.c */ +#line 860 "parse.y" + { + statement_t *new = make_statement(RETURN); + (yyval.statement) = new; + ;} + break; + + case 74: + +/* Line 1455 of yacc.c */ +#line 866 "parse.y" + { + statement_t *new = make_statement(RETURN); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 75: + +/* Line 1455 of yacc.c */ +#line 873 "parse.y" + { + statement_t *new = make_statement(STOP); + (yyval.statement) = new; + ;} + break; + + case 76: + +/* Line 1455 of yacc.c */ +#line 879 "parse.y" + { + statement_t *new = make_statement(STOP); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 77: + +/* Line 1455 of yacc.c */ +#line 886 "parse.y" + { + statement_t *new = make_statement(STRNG); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 78: + +/* Line 1455 of yacc.c */ +#line 893 "parse.y" + { + statement_t *new = make_statement(SYS); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 79: + +/* Line 1455 of yacc.c */ +#line 900 "parse.y" + { + statement_t *new = make_statement(TAB); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 80: + +/* Line 1455 of yacc.c */ +#line 907 "parse.y" + { + statement_t *new = make_statement(TIME_STR); + new->parms.generic_parameter = (yyvsp[(3) - (3)].expression); + (yyval.statement) = new; + ;} + break; + + case 81: + +/* Line 1455 of yacc.c */ +#line 914 "parse.y" + { + statement_t *new = make_statement(TIME_STR); + new->parms.generic_parameter = (yyvsp[(4) - (4)].expression); + (yyval.statement) = new; + ;} + break; + + case 82: + +/* Line 1455 of yacc.c */ +#line 921 "parse.y" + { + statement_t *new = make_statement(TRAP); + new->parms.generic_parameter = (yyvsp[(2) - (2)].expression); + (yyval.statement) = new; + ;} + break; + + case 83: + +/* Line 1455 of yacc.c */ +#line 928 "parse.y" + { + statement_t *new = make_statement(TRAP); + new->parms.generic_parameter = NULL; + (yyval.statement) = new; + ;} + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 935 "parse.y" + { + statement_t *new = make_statement(VARLIST); + (yyval.statement) = new; + ;} + break; + + case 85: + +/* Line 1455 of yacc.c */ +#line 941 "parse.y" + { + statement_t *new = make_statement(WAIT); + (yyval.statement) = new; + ;} + break; + + case 86: + +/* Line 1455 of yacc.c */ +#line 948 "parse.y" + { + statement_t *new = make_statement(LET); + new->parms.let.variable = (yyvsp[(1) - (3)].variable); + new->parms.let.expression = (yyvsp[(3) - (3)].expression); + (yyval.statement) = new; + + /* static analyser - see if we are setting a value to 0 or 1 */ + //NOTE: same code above in LET + if (new->parms.let.expression->type == number) { + if ((int)new->parms.let.expression->parms.number == 0) { + assign_zero++; + } else if ((int)new->parms.let.expression->parms.number == 1 + && (int)new->parms.let.expression->parms.number == new->parms.let.expression->parms.number) { + assign_one++; + } else { + assign_other++; + } + } + ;} + break; + + case 87: + +/* Line 1455 of yacc.c */ +#line 970 "parse.y" + { + statement_t *new = make_statement(MAT); + new->parms.mat.variable = (yyvsp[(2) - (4)].variable); + new->parms.mat.variable2 = (yyvsp[(4) - (4)].variable); + + // for all of the mat instructions, a sub-array can be defined by putting + // subscripts on either the LHR (IBM only) or RHS. RetroBASIC assumes the + // latter overrides the former, so if we find subs on one of the parameters, + // copy them over to the LHS to make them easier to find at runtime. + // + // NOTE: in theory there should only be one set of sub-array specifiers, + // and more should be an error. but we just use the right most one we find + if (new->parms.mat.variable2->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable2->subscripts; + } + + (yyval.statement) = new; + ;} + break; + + case 88: + +/* Line 1455 of yacc.c */ +#line 990 "parse.y" + { + statement_t *new = make_statement(MAT); + new->parms.mat.variable = (yyvsp[(2) - (6)].variable); + new->parms.mat.expression = (yyvsp[(5) - (6)].expression); + (yyval.statement) = new; + ;} + break; + + case 89: + +/* Line 1455 of yacc.c */ +#line 998 "parse.y" + { + statement_t *new = make_statement(MATADD); + new->parms.mat.variable = (yyvsp[(2) - (6)].variable); + new->parms.mat.variable2 = (yyvsp[(4) - (6)].variable); + new->parms.mat.variable3 = (yyvsp[(6) - (6)].variable); + + if (new->parms.mat.variable2->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable2->subscripts; + } + if (new->parms.mat.variable3->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable3->subscripts; + } + + (yyval.statement) = new; + ;} + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 1015 "parse.y" + { + statement_t *new = make_statement(MATSUB); + new->parms.mat.variable = (yyvsp[(2) - (6)].variable); + new->parms.mat.variable2 = (yyvsp[(4) - (6)].variable); + new->parms.mat.variable3 = (yyvsp[(6) - (6)].variable); + + if (new->parms.mat.variable2->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable2->subscripts; + } + if (new->parms.mat.variable3->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable3->subscripts; + } + + (yyval.statement) = new; + ;} + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 1032 "parse.y" + { + statement_t *new = make_statement(MATSCA); + new->parms.mat.variable = (yyvsp[(2) - (8)].variable); + new->parms.mat.expression = (yyvsp[(5) - (8)].expression); + new->parms.mat.variable3 = (yyvsp[(8) - (8)].variable); + + if (new->parms.mat.variable3->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable3->subscripts; + } + + (yyval.statement) = new; + ;} + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 1046 "parse.y" + { + statement_t *new = make_statement(MATMUL); + new->parms.mat.variable = (yyvsp[(2) - (6)].variable); + new->parms.mat.variable2 = (yyvsp[(4) - (6)].variable); + new->parms.mat.variable3 = (yyvsp[(6) - (6)].variable); + + if (new->parms.mat.variable2->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable2->subscripts; + } + if (new->parms.mat.variable3->subscripts != NULL) { + new->parms.mat.variable->subscripts = new->parms.mat.variable3->subscripts; + } + + (yyval.statement) = new; + ;} + break; + + case 93: + +/* Line 1455 of yacc.c */ +#line 1063 "parse.y" + { + statement_t *new = make_statement(MATPRINT); + new->parms.print.item_list = (yyvsp[(3) - (3)].l); + (yyval.statement) = new; + ;} + break; + + case 94: + +/* Line 1455 of yacc.c */ +#line 1070 "parse.y" + { + statement_t *new = make_statement(MATINPUT); + new->parms.input = (yyvsp[(3) - (3)].l); + (yyval.statement) = new; + ;} + break; + + case 95: + +/* Line 1455 of yacc.c */ +#line 1077 "parse.y" + { + statement_t *new = make_statement(MATREAD); + new->parms.read = (yyvsp[(3) - (3)].l); + + (yyval.statement) = new; + ;} + break; + + case 96: + +/* Line 1455 of yacc.c */ +#line 1085 "parse.y" + { + statement_t *new = make_statement(MATCON); + new->parms.mat.variable = (yyvsp[(2) - (4)].variable); + (yyval.statement) = new; + ;} + break; + + case 97: + +/* Line 1455 of yacc.c */ +#line 1092 "parse.y" + { + statement_t *new = make_statement(MATCON); + new->parms.mat.variable = (yyvsp[(2) - (7)].variable); + new->parms.mat.variable->subscripts = (yyvsp[(6) - (7)].l); + (yyval.statement) = new; + ;} + break; + + case 98: + +/* Line 1455 of yacc.c */ +#line 1100 "parse.y" + { + // there are two ways to get the DET, one is a normal function, + // the other is the IBM version of INV + statement_t *new = make_statement(MATDET); + new->parms.mat.variable = (yyvsp[(2) - (4)].variable); + (yyval.statement) = new; + ;} + break; + + case 99: + +/* Line 1455 of yacc.c */ +#line 1109 "parse.y" + { + statement_t *new = make_statement(MATZER); + new->parms.mat.variable = (yyvsp[(2) - (4)].variable); + (yyval.statement) = new; + ;} + break; + + case 100: + +/* Line 1455 of yacc.c */ +#line 1116 "parse.y" + { + statement_t *new = make_statement(MATZER); + new->parms.mat.variable = (yyvsp[(2) - (7)].variable); + new->parms.mat.variable->subscripts = (yyvsp[(6) - (7)].l); + (yyval.statement) = new; + ;} + break; + + case 101: + +/* Line 1455 of yacc.c */ +#line 1124 "parse.y" + { + statement_t *new = make_statement(MATIDN); + new->parms.mat.variable = (yyvsp[(2) - (4)].variable); + (yyval.statement) = new; + ;} + break; + + case 102: + +/* Line 1455 of yacc.c */ +#line 1131 "parse.y" + { + statement_t *new = make_statement(MATIDN); + new->parms.mat.variable = (yyvsp[(2) - (7)].variable); + new->parms.mat.variable->subscripts = (yyvsp[(6) - (7)].l); + (yyval.statement) = new; + ;} + break; + + case 103: + +/* Line 1455 of yacc.c */ +#line 1139 "parse.y" + { + statement_t *new = make_statement(MATINV); + new->parms.mat.variable = (yyvsp[(2) - (7)].variable); + new->parms.mat.variable2 = (yyvsp[(6) - (7)].variable); + (yyval.statement) = new; + ;} + break; + + case 104: + +/* Line 1455 of yacc.c */ +#line 1147 "parse.y" + { + // this is the IBM 5100 version, which returns the determinant + statement_t *new = make_statement(MATINV); + new->parms.mat.variable = (yyvsp[(2) - (9)].variable); + new->parms.mat.variable2 = (yyvsp[(6) - (9)].variable); + new->parms.mat.variable3 = (yyvsp[(9) - (9)].variable); + (yyval.statement) = new; + ;} + break; + + case 105: + +/* Line 1455 of yacc.c */ +#line 1157 "parse.y" + { + statement_t *new = make_statement(MATTRN); + new->parms.mat.variable = (yyvsp[(2) - (7)].variable); + new->parms.mat.variable2 = (yyvsp[(6) - (7)].variable); + (yyval.statement) = new; + ;} + break; + + case 108: + +/* Line 1455 of yacc.c */ +#line 1174 "parse.y" + { + expression_t *new = make_operator(2, (yyvsp[(2) - (3)].i)); + new->parms.op.p[0] = (yyvsp[(1) - (3)].expression); + new->parms.op.p[1] = (yyvsp[(3) - (3)].expression); + (yyval.expression) = new; + ;} + break; + + case 109: + +/* Line 1455 of yacc.c */ +#line 1183 "parse.y" + { (yyval.i) = AND; ;} + break; + + case 110: + +/* Line 1455 of yacc.c */ +#line 1184 "parse.y" + { (yyval.i) = OR; ;} + break; + + case 112: + +/* Line 1455 of yacc.c */ +#line 1191 "parse.y" + { + expression_t *new = make_operator(2, (yyvsp[(2) - (3)].i)); + new->parms.op.p[0] = (yyvsp[(1) - (3)].expression); + new->parms.op.p[1] = (yyvsp[(3) - (3)].expression); + (yyval.expression) = new; + + /* static analyser - see if this is a comparison to zero or one */ + if (new->parms.op.p[1]->type == number) { + // test for floats first + if (ceil(new->parms.op.p[1]->parms.number) != new->parms.op.p[1]->parms.number) { + if (new->parms.op.opcode == '=') { + compare_equals_other++; + } else { + compare_not_equals_other++; + } + } else { // otherwise test ints + if ((int)new->parms.op.p[1]->parms.number == 0) { + if (new->parms.op.opcode == '=') { + compare_equals_zero++; + } else { + compare_not_equals_zero++; + } + } else if ((int)new->parms.op.p[1]->parms.number == 1) { + if (new->parms.op.opcode == '=') { + compare_equals_one++; + } else { + compare_not_equals_one++; + } + } else { + if (new->parms.op.opcode == '=') { + compare_equals_other++; + } else { + compare_not_equals_other++; + } + } + } + } + ;} + break; + + case 113: + +/* Line 1455 of yacc.c */ +#line 1232 "parse.y" + { (yyval.i) = '='; ;} + break; + + case 114: + +/* Line 1455 of yacc.c */ +#line 1233 "parse.y" + { (yyval.i) = '<'; ;} + break; + + case 115: + +/* Line 1455 of yacc.c */ +#line 1234 "parse.y" + { (yyval.i) = '>'; ;} + break; + + case 116: + +/* Line 1455 of yacc.c */ +#line 1235 "parse.y" + { (yyval.i) = CMP_LE; ;} + break; + + case 117: + +/* Line 1455 of yacc.c */ +#line 1236 "parse.y" + { (yyval.i) = CMP_GE; ;} + break; + + case 118: + +/* Line 1455 of yacc.c */ +#line 1237 "parse.y" + { (yyval.i) = CMP_NE; ;} + break; + + case 119: + +/* Line 1455 of yacc.c */ +#line 1238 "parse.y" + { (yyval.i) = CMP_HASH; ;} + break; + + case 121: + +/* Line 1455 of yacc.c */ +#line 1245 "parse.y" + { + expression_t *new = make_operator(2, (yyvsp[(2) - (3)].i)); + new->parms.op.p[0] = (yyvsp[(1) - (3)].expression); + new->parms.op.p[1] = (yyvsp[(3) - (3)].expression); + (yyval.expression) = new; + + /* static analyser - if it's + or - 1, record it as an increment */ + if (new->parms.op.p[1]->type == number + && (int)new->parms.op.p[1]->parms.number == 1 + && (int)new->parms.op.p[1]->parms.number == new->parms.op.p[1]->parms.number) { + if (new->parms.op.opcode == '+') { + increments++; + } else { + decrements++; + } + } + ;} + break; + + case 122: + +/* Line 1455 of yacc.c */ +#line 1264 "parse.y" + { (yyval.i) = '+'; ;} + break; + + case 123: + +/* Line 1455 of yacc.c */ +#line 1265 "parse.y" + { (yyval.i) = '-'; ;} + break; + + case 124: + +/* Line 1455 of yacc.c */ +#line 1266 "parse.y" + { (yyval.i) = '&'; ;} + break; + + case 126: + +/* Line 1455 of yacc.c */ +#line 1273 "parse.y" + { + expression_t *new = make_operator(2, (yyvsp[(2) - (3)].i)); + new->parms.op.p[0] = (yyvsp[(1) - (3)].expression); + new->parms.op.p[1] = (yyvsp[(3) - (3)].expression); + (yyval.expression) = new; + ;} + break; + + case 127: + +/* Line 1455 of yacc.c */ +#line 1281 "parse.y" + { (yyval.i) = '*'; ;} + break; + + case 128: + +/* Line 1455 of yacc.c */ +#line 1282 "parse.y" + { (yyval.i) = '/'; ;} + break; + + case 129: + +/* Line 1455 of yacc.c */ +#line 1283 "parse.y" + { (yyval.i) = MOD; ;} + break; + + case 130: + +/* Line 1455 of yacc.c */ +#line 1284 "parse.y" + { (yyval.i) = DIV; ;} + break; + + case 131: + +/* Line 1455 of yacc.c */ +#line 1285 "parse.y" + { (yyval.i) = MAX; ;} + break; + + case 132: + +/* Line 1455 of yacc.c */ +#line 1286 "parse.y" + { (yyval.i) = MIN; ;} + break; + + case 133: + +/* Line 1455 of yacc.c */ +#line 1287 "parse.y" + { (yyval.i) = '^'; ;} + break; + + case 135: + +/* Line 1455 of yacc.c */ +#line 1293 "parse.y" + { + expression_t *new = make_operator(1, (yyvsp[(1) - (2)].i)); + new->parms.op.p[0] = (yyvsp[(2) - (2)].expression); + (yyval.expression) = new; + ;} + break; + + case 136: + +/* Line 1455 of yacc.c */ +#line 1301 "parse.y" + { (yyval.i) = '-'; ;} + break; + + case 137: + +/* Line 1455 of yacc.c */ +#line 1302 "parse.y" + { (yyval.i) = NOT; ;} + break; + + case 139: + +/* Line 1455 of yacc.c */ +#line 1310 "parse.y" + { + expression_t *new = make_operator(0, (yyvsp[(1) - (1)].i)); + (yyval.expression) = new; + ;} + break; + + case 140: + +/* Line 1455 of yacc.c */ +#line 1317 "parse.y" + { + expression_t *new = make_operator(0, (yyvsp[(1) - (3)].i)); + (yyval.expression) = new; + ;} + break; + + case 141: + +/* Line 1455 of yacc.c */ +#line 1323 "parse.y" + { + expression_t *new = make_operator(0, (yyvsp[(1) - (4)].i)); + new->parms.op.p[0] = (yyvsp[(3) - (4)].expression); + (yyval.expression) = new; + ;} + break; + + case 142: + +/* Line 1455 of yacc.c */ +#line 1330 "parse.y" + { + expression_t *new = make_operator(1, (yyvsp[(1) - (4)].i)); + new->parms.op.p[0] = (yyvsp[(3) - (4)].expression); + (yyval.expression) = new; + ;} + break; + + case 143: + +/* Line 1455 of yacc.c */ +#line 1337 "parse.y" + { + expression_t *new = make_operator(2, (yyvsp[(1) - (6)].i)); + new->parms.op.p[0] = (yyvsp[(3) - (6)].expression); + new->parms.op.p[1] = (yyvsp[(5) - (6)].expression); + (yyval.expression) = new; + ;} + break; + + case 144: + +/* Line 1455 of yacc.c */ +#line 1346 "parse.y" + { + expression_t *new = make_operator(0, (yyvsp[(1) - (1)].i)); + (yyval.expression) = new; + ;} + break; + + case 145: + +/* Line 1455 of yacc.c */ +#line 1353 "parse.y" + { + expression_t *new = make_operator(1, (yyvsp[(1) - (4)].i)); + new->parms.op.p[0] = (yyvsp[(3) - (4)].expression); + (yyval.expression) = new; + ;} + break; + + case 146: + +/* Line 1455 of yacc.c */ +#line 1361 "parse.y" + { + expression_t *new = make_operator(2, (yyvsp[(1) - (6)].i)); + new->parms.op.p[0] = (yyvsp[(3) - (6)].expression); + new->parms.op.p[1] = (yyvsp[(5) - (6)].expression); + (yyval.expression) = new; + ;} + break; + + case 147: + +/* Line 1455 of yacc.c */ +#line 1370 "parse.y" + { + expression_t *new = make_operator(3, (yyvsp[(1) - (8)].i)); + new->parms.op.p[0] = (yyvsp[(3) - (8)].expression); + new->parms.op.p[1] = (yyvsp[(5) - (8)].expression); + new->parms.op.p[2] = (yyvsp[(7) - (8)].expression); + (yyval.expression) = new; + ;} + break; + + case 148: + +/* Line 1455 of yacc.c */ +#line 1381 "parse.y" + { (yyval.i) = INKEY; ;} + break; + + case 149: + +/* Line 1455 of yacc.c */ +#line 1382 "parse.y" + { (yyval.i) = FRE; ;} + break; + + case 150: + +/* Line 1455 of yacc.c */ +#line 1383 "parse.y" + { (yyval.i) = PI; ;} + break; + + case 151: + +/* Line 1455 of yacc.c */ +#line 1384 "parse.y" + { (yyval.i) = RND; ;} + break; + + case 152: + +/* Line 1455 of yacc.c */ +#line 1385 "parse.y" + { (yyval.i) = TIME; ;} + break; + + case 153: + +/* Line 1455 of yacc.c */ +#line 1386 "parse.y" + { (yyval.i) = TIME_STR; ;} + break; + + case 154: + +/* Line 1455 of yacc.c */ +#line 1387 "parse.y" + { (yyval.i) = EL; ;} + break; + + case 155: + +/* Line 1455 of yacc.c */ +#line 1388 "parse.y" + { (yyval.i) = ER; ;} + break; + + case 156: + +/* Line 1455 of yacc.c */ +#line 1389 "parse.y" + { (yyval.i) = MATDET; ;} + break; + + case 157: + +/* Line 1455 of yacc.c */ +#line 1394 "parse.y" + { (yyval.i) = ABS; ;} + break; + + case 158: + +/* Line 1455 of yacc.c */ +#line 1395 "parse.y" + { (yyval.i) = ADR; ;} + break; + + case 159: + +/* Line 1455 of yacc.c */ +#line 1396 "parse.y" + { (yyval.i) = ATN; ;} + break; + + case 160: + +/* Line 1455 of yacc.c */ +#line 1397 "parse.y" + { (yyval.i) = BIN; ;} + break; + + case 161: + +/* Line 1455 of yacc.c */ +#line 1398 "parse.y" + { (yyval.i) = BINSTR; ;} + break; + + case 162: + +/* Line 1455 of yacc.c */ +#line 1399 "parse.y" + { (yyval.i) = CHR; ;} + break; + + case 163: + +/* Line 1455 of yacc.c */ +#line 1400 "parse.y" + { (yyval.i) = CLOG;;} + break; + + case 164: + +/* Line 1455 of yacc.c */ +#line 1401 "parse.y" + { (yyval.i) = COS; ;} + break; + + case 165: + +/* Line 1455 of yacc.c */ +#line 1402 "parse.y" + { (yyval.i) = EXP; ;} + break; + + case 166: + +/* Line 1455 of yacc.c */ +#line 1403 "parse.y" + { (yyval.i) = FIX; ;} + break; + + case 167: + +/* Line 1455 of yacc.c */ +#line 1404 "parse.y" + { (yyval.i) = FRAC; ;} + break; + + case 168: + +/* Line 1455 of yacc.c */ +#line 1405 "parse.y" + { (yyval.i) = HEX; ;} + break; + + case 169: + +/* Line 1455 of yacc.c */ +#line 1406 "parse.y" + { (yyval.i) = HEXSTR; ;} + break; + + case 170: + +/* Line 1455 of yacc.c */ +#line 1407 "parse.y" + { (yyval.i) = INT; ;} + break; + + case 171: + +/* Line 1455 of yacc.c */ +#line 1408 "parse.y" + { (yyval.i) = LCASE; ;} + break; + + case 172: + +/* Line 1455 of yacc.c */ +#line 1409 "parse.y" + { (yyval.i) = LEN; ;} + break; + + case 173: + +/* Line 1455 of yacc.c */ +#line 1410 "parse.y" + { (yyval.i) = LIN; ;} + break; + + case 174: + +/* Line 1455 of yacc.c */ +#line 1411 "parse.y" + { (yyval.i) = LOG; ;} + break; + + case 175: + +/* Line 1455 of yacc.c */ +#line 1412 "parse.y" + { (yyval.i) = OCT; ;} + break; + + case 176: + +/* Line 1455 of yacc.c */ +#line 1413 "parse.y" + { (yyval.i) = OCTSTR; ;} + break; + + case 177: + +/* Line 1455 of yacc.c */ +#line 1414 "parse.y" + { (yyval.i) = PEEK;;} + break; + + case 178: + +/* Line 1455 of yacc.c */ +#line 1415 "parse.y" + { (yyval.i) = SGN; ;} + break; + + case 179: + +/* Line 1455 of yacc.c */ +#line 1416 "parse.y" + { (yyval.i) = SIN; ;} + break; + + case 180: + +/* Line 1455 of yacc.c */ +#line 1417 "parse.y" + { (yyval.i) = SPC; ;} + break; + + case 181: + +/* Line 1455 of yacc.c */ +#line 1418 "parse.y" + { (yyval.i) = SQR; ;} + break; + + case 182: + +/* Line 1455 of yacc.c */ +#line 1419 "parse.y" + { (yyval.i) = STR; ;} + break; + + case 183: + +/* Line 1455 of yacc.c */ +#line 1420 "parse.y" + { (yyval.i) = TAB; ;} + break; + + case 184: + +/* Line 1455 of yacc.c */ +#line 1421 "parse.y" + { (yyval.i) = VAL; ;} + break; + + case 185: + +/* Line 1455 of yacc.c */ +#line 1422 "parse.y" + { (yyval.i) = UCASE; ;} + break; + + case 186: + +/* Line 1455 of yacc.c */ +#line 1423 "parse.y" + { (yyval.i) = USR; ;} + break; + + case 187: + +/* Line 1455 of yacc.c */ +#line 1424 "parse.y" + { (yyval.i) = ERR; ;} + break; + + case 188: + +/* Line 1455 of yacc.c */ +#line 1429 "parse.y" + { (yyval.i) = DIV; ;} + break; + + case 189: + +/* Line 1455 of yacc.c */ +#line 1430 "parse.y" + { (yyval.i) = MOD; ;} + break; + + case 190: + +/* Line 1455 of yacc.c */ +#line 1431 "parse.y" + { (yyval.i) = MAX; ;} + break; + + case 191: + +/* Line 1455 of yacc.c */ +#line 1432 "parse.y" + { (yyval.i) = MIN; ;} + break; + + case 192: + +/* Line 1455 of yacc.c */ +#line 1433 "parse.y" + { (yyval.i) = LEFT; ;} + break; + + case 193: + +/* Line 1455 of yacc.c */ +#line 1434 "parse.y" + { (yyval.i) = RIGHT; ;} + break; + + case 194: + +/* Line 1455 of yacc.c */ +#line 1435 "parse.y" + { (yyval.i) = STRNG; ;} + break; + + case 195: + +/* Line 1455 of yacc.c */ +#line 1440 "parse.y" + { (yyval.i) = INSTR; ;} + break; + + case 196: + +/* Line 1455 of yacc.c */ +#line 1441 "parse.y" + { (yyval.i) = POS; ;} + break; + + case 197: + +/* Line 1455 of yacc.c */ +#line 1442 "parse.y" + { (yyval.i) = MID; ;} + break; + + case 198: + +/* Line 1455 of yacc.c */ +#line 1443 "parse.y" + { (yyval.i) = SEG; ;} + break; + + case 199: + +/* Line 1455 of yacc.c */ +#line 1444 "parse.y" + { (yyval.i) = SUBSTR; ;} + break; + + case 200: + +/* Line 1455 of yacc.c */ +#line 1445 "parse.y" + { (yyval.i) = ROUND; ;} + break; + + case 201: + +/* Line 1455 of yacc.c */ +#line 1446 "parse.y" + { (yyval.i) = UBOUND; ;} + break; + + case 202: + +/* Line 1455 of yacc.c */ +#line 1447 "parse.y" + { (yyval.i) = LBOUND; ;} + break; + + case 203: + +/* Line 1455 of yacc.c */ +#line 1448 "parse.y" + { (yyval.i) = MATCON; ;} + break; + + case 204: + +/* Line 1455 of yacc.c */ +#line 1449 "parse.y" + { (yyval.i) = MATIDN; ;} + break; + + case 205: + +/* Line 1455 of yacc.c */ +#line 1450 "parse.y" + { (yyval.i) = MATINV; ;} + break; + + case 206: + +/* Line 1455 of yacc.c */ +#line 1451 "parse.y" + { (yyval.i) = MATTRN; ;} + break; + + case 207: + +/* Line 1455 of yacc.c */ +#line 1452 "parse.y" + { (yyval.i) = MATZER; ;} + break; + + case 208: + +/* Line 1455 of yacc.c */ +#line 1461 "parse.y" + { + /* actual parsing code */ + expression_t *new = make_expression(number); + new->parms.number = (yyvsp[(1) - (1)].d); + (yyval.expression) = new; + + /* static analyzer code */ + /* numbers here are not *all* of numbers in a program, line numbers + (for instance) don't end up here. This *is* what we want for the + analyzer. + This means we have to track line numbers separately, like in the + case of GOTO etc. This will, however, capture all the numbers found + in expressions, PRINT statements, user formulas, POKEs, etc. + */ + numeric_constants_total++; + + /* basic sizes for ints */ + double num = new->parms.number; + if (floorf(num) == num) { + // count decimal digits + if (num == 0) { + numeric_constants_zero++; + } else if (num == 1) { + numeric_constants_one++; + } else if (num == -1) { + numeric_constants_minus_one++; + } else if (num >= -9 && num <= 9) { + numeric_constants_one_digit++; // note: not 1 or zero + } else if (num >= -99 && num <= 99) { + numeric_constants_two_digit++; + } else if (num >= -999 && num <= 999) { + numeric_constants_three_digit++; + } else if (num >= -9999 && num <= 9999) { + numeric_constants_four_digit++; + } else if (num >= -99999 && num <= 99999) { + numeric_constants_five_digit++; + } else { + numeric_constants_big++; + } + + // count number of bytes separately + if (num >= -128 && num <= 256) { + numeric_constants_one_byte++; + } else if (num >= -32767 && num <= 65536) { + numeric_constants_two_byte++; + } else if (num >= INT_MIN && num <= INT_MAX) { + /* this one is probably redundant! */ + numeric_constants_four_byte++; + } + } + /* everything else is a float */ + else { + numeric_constants_float++; + } + ;} + break; + + case 209: + +/* Line 1455 of yacc.c */ +#line 1518 "parse.y" + { + expression_t *new = make_expression(string); + new->parms.string = (yyvsp[(1) - (1)].s); + (yyval.expression) = new; + + /* static analyzer code */ + size_t len = strlen((yyvsp[(1) - (1)].s)); + string_constants_total++; + if (len == 0) { + string_constants_zero++; + } else if (len == 1) { + string_constants_one_byte++; + } else { + string_constants_big++; + } + if (len > string_constants_max) string_constants_max = (int)len; + ;} + break; + + case 210: + +/* Line 1455 of yacc.c */ +#line 1537 "parse.y" + { + expression_t *new = make_expression(variable); + new->parms.variable = (yyvsp[(1) - (1)].variable); + (yyval.expression) = new; + ;} + break; + + case 211: + +/* Line 1455 of yacc.c */ +#line 1544 "parse.y" + { + expression_t *new = make_expression(fn); + new->parms.variable = (yyvsp[(1) - (1)].variable); // use the variable slot here, it has the same signature + (yyval.expression) = new; + ;} + break; + + case 212: + +/* Line 1455 of yacc.c */ +#line 1551 "parse.y" + { + (yyval.expression) = (yyvsp[(2) - (3)].expression); + ;} + break; + + case 213: + +/* Line 1455 of yacc.c */ +#line 1562 "parse.y" + { + variable_reference_t *new = malloc(sizeof(*new)); + new->name = (yyvsp[(1) - (4)].s); + new->subscripts = (yyvsp[(3) - (4)].l); + (yyval.variable) = new; + // do NOT insert it now, the variables are private and will be set up during the DEF + ;} + break; + + case 214: + +/* Line 1455 of yacc.c */ +#line 1572 "parse.y" + { + variable_reference_t *new = malloc(sizeof(*new)); + new->name = (yyvsp[(1) - (1)].s); + new->subscripts = NULL; + new->slicing = NULL; + (yyval.variable) = new; + + /* add it to the interpreter's variable list for the analyizer*/ + insert_variable(new); + ;} + break; + + case 215: + +/* Line 1455 of yacc.c */ +#line 1584 "parse.y" + { + variable_reference_t *new = malloc(sizeof(*new)); + new->name = (yyvsp[(1) - (4)].s); + new->subscripts = (yyvsp[(3) - (4)].l); + new->slicing = NULL; + (yyval.variable) = new; + + /* this may result in errors about array bounds if you OPTION BASE after the DIM */ + insert_variable(new); + ;} + break; + + case 216: + +/* Line 1455 of yacc.c */ +#line 1596 "parse.y" + { + variable_reference_t *new = malloc(sizeof(*new)); + new->name = (yyvsp[(1) - (4)].s); + new->subscripts = (yyvsp[(3) - (4)].l); + new->slicing = NULL; + (yyval.variable) = new; + + // square brackets tell us we are in the HP dialect, which means... + string_slicing = true; + + insert_variable(new); + ;} + break; + + case 217: + +/* Line 1455 of yacc.c */ +#line 1610 "parse.y" + { + /* this is the ANSI-style slicing command */ + /* NOTE: this should only ever occur in non-HP dialects, so the []'s would never appear */ + variable_reference_t *new = malloc(sizeof(*new)); + new->name = (yyvsp[(1) - (4)].s); + new->subscripts = NULL; + new->slicing = (yyvsp[(3) - (4)].l); + (yyval.variable) = new; + + insert_variable(new); + ;} + break; + + case 218: + +/* Line 1455 of yacc.c */ +#line 1623 "parse.y" + { + /* and this is ANSI slicing of an entry in a string array */ + variable_reference_t *new = malloc(sizeof(*new)); + new->name = (yyvsp[(1) - (7)].s); + new->subscripts = (yyvsp[(3) - (7)].l); + new->slicing = (yyvsp[(6) - (7)].l); + (yyval.variable) = new; + + insert_variable(new); + ;} + break; + + case 219: + +/* Line 1455 of yacc.c */ +#line 1637 "parse.y" + { + (yyval.l) = NULL; + ;} + break; + + case 220: + +/* Line 1455 of yacc.c */ +#line 1642 "parse.y" + { + printitem_t *new = malloc(sizeof(*new)); + new->expression = (yyvsp[(1) - (1)].expression); + new->separator = 0; + (yyval.l) = lst_append(NULL, new); + ;} + break; + + case 221: + +/* Line 1455 of yacc.c */ +#line 1651 "parse.y" + { + printitem_t *new = malloc(sizeof(*new)); + new->expression = (yyvsp[(2) - (2)].expression); + new->separator = 0; + (yyval.l) = lst_append((yyvsp[(1) - (2)].l), new); + ;} + break; + + case 222: + +/* Line 1455 of yacc.c */ +#line 1660 "parse.y" + { + printitem_t *new = malloc(sizeof(*new)); + new->expression = NULL; + new->separator = (yyvsp[(1) - (1)].i); + (yyval.l) = lst_append(NULL, new); + ;} + break; + + case 223: + +/* Line 1455 of yacc.c */ +#line 1668 "parse.y" + { + printitem_t *new = malloc(sizeof(*new)); + new->expression = NULL; + new->separator = (yyvsp[(2) - (2)].i); + (yyval.l) = lst_append((yyvsp[(1) - (2)].l), new); + ;} + break; + + case 224: + +/* Line 1455 of yacc.c */ +#line 1678 "parse.y" + { + (yyval.i) = ','; + ;} + break; + + case 225: + +/* Line 1455 of yacc.c */ +#line 1683 "parse.y" + { + (yyval.i) = ';'; + ;} + break; + + case 226: + +/* Line 1455 of yacc.c */ +#line 1691 "parse.y" + { + (yyval.l) = lst_prepend(NULL, (yyvsp[(1) - (1)].expression)); + ;} + break; + + case 227: + +/* Line 1455 of yacc.c */ +#line 1696 "parse.y" + { + (yyval.l) = lst_append((yyvsp[(1) - (3)].l), (yyvsp[(3) - (3)].expression)); + ;} + break; + + case 228: + +/* Line 1455 of yacc.c */ +#line 1706 "parse.y" + { + (yyval.l) = lst_prepend(NULL, (yyvsp[(1) - (3)].expression)); + (yyval.l) = lst_append((yyval.l), (yyvsp[(3) - (3)].expression)); + ;} + break; + + case 229: + +/* Line 1455 of yacc.c */ +#line 1712 "parse.y" + { + (yyval.l) = lst_prepend(NULL, (yyvsp[(1) - (3)].expression)); + (yyval.l) = lst_append((yyval.l), (yyvsp[(3) - (3)].expression)); + ;} + break; + + case 230: + +/* Line 1455 of yacc.c */ +#line 1736 "parse.y" + { + (yyval.l) = lst_prepend(NULL, (yyvsp[(1) - (1)].variable)); + ;} + break; + + case 231: + +/* Line 1455 of yacc.c */ +#line 1741 "parse.y" + { + (yyval.l) = lst_append((yyvsp[(1) - (3)].l), (yyvsp[(3) - (3)].variable)); + ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 4687 "parse.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 1746 "parse.y" + + diff --git a/src/retrobasic.c b/src/retrobasic.c index acf4edfc..f7b371d3 100644 --- a/src/retrobasic.c +++ b/src/retrobasic.c @@ -21,7 +21,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include // for run timers #include // used for sleep #include "retrobasic.h" @@ -30,9 +29,16 @@ #include "matrix.h" #if _WIN32 +#define _USE_MATH_DEFINES +#define TERMIWIN_DONOTREDEFINE +#define STDIN_FILENO 0 + #include #include + #include "winsupport.h" + #include "termios.h" #else #include + #include // for run timers #endif /* here's the actual definition of the interpreter state which is extern in the header */ diff --git a/src/statistics.c b/src/statistics.c index 733013fd..59057340 100644 --- a/src/statistics.c +++ b/src/statistics.c @@ -22,6 +22,13 @@ #include "parse.h" +#if _WIN32 +#define _USE_MATH_DEFINES +#include "winsupport.h" +#else +#include // for run timers +#endif + /* declarations of the externs from the header */ int variables_total = 0; int variables_default = 0; @@ -118,13 +125,11 @@ void print_statistics(void) if (i < line_min) line_min = i; if (i > line_max) line_max = i; - switch(i) { - case 0 ... 9 : linenum_1_digit++; linenum_tot_digits = linenum_tot_digits + 1; break; - case 10 ... 99 : linenum_2_digit++; linenum_tot_digits = linenum_tot_digits + 2; break; - case 100 ... 999 : linenum_3_digit++; linenum_tot_digits = linenum_tot_digits + 3; break; - case 1000 ... 9999 : linenum_4_digit++; linenum_tot_digits = linenum_tot_digits + 4; break; - case 10000 ... 99999 : linenum_5_digit++; linenum_tot_digits = linenum_tot_digits + 5; break; - } + if (i >= 0 && i <= 9) { linenum_1_digit++; linenum_tot_digits = linenum_tot_digits + 1; } + else if (i >= 10 && i <= 99) { linenum_2_digit++; linenum_tot_digits = linenum_tot_digits + 2; } + else if (i >= 100 && i <= 999) { linenum_3_digit++; linenum_tot_digits = linenum_tot_digits + 3; } + else if (i >= 1000 && i <= 9999) { linenum_4_digit++; linenum_tot_digits = linenum_tot_digits + 4; } + else if (i >= 10000 && i <= 99999) { linenum_5_digit++; linenum_tot_digits = linenum_tot_digits + 5; } } } diff --git a/src/winsupport.c b/src/winsupport.c new file mode 100644 index 00000000..31b06aa8 --- /dev/null +++ b/src/winsupport.c @@ -0,0 +1,45 @@ + +#include +#include + +int gettimeofday(struct timeval* tp, struct timezone* tzp) +{ + // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's + // This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC) + // until 00:00:00 January 1, 1970 + static const uint64_t EPOCH = ((uint64_t)116444736000000000ULL); + + SYSTEMTIME system_time; + FILETIME file_time; + uint64_t time; + + GetSystemTime(&system_time); + SystemTimeToFileTime(&system_time, &file_time); + time = ((uint64_t)file_time.dwLowDateTime); + time += ((uint64_t)file_time.dwHighDateTime) << 32; + + tp->tv_sec = (long)((time - EPOCH) / 10000000L); + tp->tv_usec = (long)(system_time.wMilliseconds * 1000); + return 0; +} + +void timersub(struct timeval* a, struct timeval* b, struct timeval* res) +{ + // implementation of timersub + res->tv_sec = a->tv_sec - b->tv_sec; + res->tv_usec = a->tv_usec - b->tv_usec; + if (res->tv_usec < 0) { + res->tv_sec--; + res->tv_usec += 1000000; + } +} + +unsigned int sleep(unsigned int seconds) +{ + Sleep(seconds * 1000); +} + +void clrscr() +{ + system("cls"); +} \ No newline at end of file diff --git a/src/winsupport.h b/src/winsupport.h new file mode 100644 index 00000000..a9cadd05 --- /dev/null +++ b/src/winsupport.h @@ -0,0 +1,17 @@ + +#ifndef WINSUPPORT_H +#define WINSUPPORT_H + +typedef struct timeval { + long tv_sec; + long tv_usec; +} timeval; + +struct timezone; + +extern int gettimeofday(struct timeval* tp, struct timezone* tzp); +extern void timersub(struct timeval* a, struct timeval* b, struct timeval* res); +extern unsigned int sleep(unsigned int seconds); +extern void clrscr(); + +#endif \ No newline at end of file diff --git a/vs/RetroBASIC.sln b/vs/RetroBASIC.sln new file mode 100644 index 00000000..00295b13 --- /dev/null +++ b/vs/RetroBASIC.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35431.28 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroBASIC", "RetroBASIC.vcxproj", "{27A77D5B-1930-484B-9CD7-E0FC69201B58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Debug|x64.ActiveCfg = Debug|x64 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Debug|x64.Build.0 = Debug|x64 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Debug|x86.ActiveCfg = Debug|Win32 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Debug|x86.Build.0 = Debug|Win32 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Release|x64.ActiveCfg = Release|x64 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Release|x64.Build.0 = Release|x64 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Release|x86.ActiveCfg = Release|Win32 + {27A77D5B-1930-484B-9CD7-E0FC69201B58}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B302EAC7-7997-4A79-9CED-7106B2BAA791} + EndGlobalSection +EndGlobal diff --git a/vs/RetroBASIC.vcxproj b/vs/RetroBASIC.vcxproj new file mode 100644 index 00000000..7b2dfb59 --- /dev/null +++ b/vs/RetroBASIC.vcxproj @@ -0,0 +1,182 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {27a77d5b-1930-484b-9cd7-e0fc69201b58} + RetroBASIC + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)..\extern\termiWin\include;$(ProjectDir)..\extern\getopt-for-windows;$(IncludePath) + + + $(ProjectDir)..\extern\termiWin\include;$(ProjectDir)..\extern\getopt-for-windows;$(IncludePath) + + + $(ProjectDir)..\extern\termiWin\include;$(ProjectDir)..\extern\getopt-for-windows;$(IncludePath) + + + $(ProjectDir)..\extern\termiWin\include;$(ProjectDir)..\extern\getopt-for-windows;$(IncludePath) + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vs/RetroBASIC.vcxproj.filters b/vs/RetroBASIC.vcxproj.filters new file mode 100644 index 00000000..63e950be --- /dev/null +++ b/vs/RetroBASIC.vcxproj.filters @@ -0,0 +1,97 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + + + \ No newline at end of file diff --git a/vs/RetroBASIC.vcxproj.user b/vs/RetroBASIC.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/vs/RetroBASIC.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file