diff --git a/direct/src/dcparser/dcLexer.cxx.prebuilt b/direct/src/dcparser/dcLexer.cxx.prebuilt index 2ae48ecfe1..c985c2b312 100644 --- a/direct/src/dcparser/dcLexer.cxx.prebuilt +++ b/direct/src/dcparser/dcLexer.cxx.prebuilt @@ -1,2476 +1,2497 @@ -#define yy_create_buffer dcyy_create_buffer -#define yy_delete_buffer dcyy_delete_buffer -#define yy_scan_buffer dcyy_scan_buffer -#define yy_scan_string dcyy_scan_string -#define yy_scan_bytes dcyy_scan_bytes -#define yy_flex_debug dcyy_flex_debug -#define yy_init_buffer dcyy_init_buffer -#define yy_flush_buffer dcyy_flush_buffer -#define yy_load_buffer_state dcyy_load_buffer_state -#define yy_switch_to_buffer dcyy_switch_to_buffer -#define yyin dcyyin -#define yyleng dcyyleng -#define yylex dcyylex -#define yyout dcyyout -#define yyrestart dcyyrestart -#define yytext dcyytext -#define yywrap dcyywrap - -#line 20 "lex.yy.c" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - */ - -#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 - -/* 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) - -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -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 44 -#define YY_END_OF_BUFFER 45 -static yyconst short int yy_accept[165] = - { 0, - 0, 0, 45, 43, 2, 1, 39, 40, 43, 43, - 43, 35, 35, 41, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 1, 0, 36, 38, 4, 3, - 38, 35, 37, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, - 3, 37, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 0, 38, 25, - 42, 12, 34, 42, 42, 42, 7, 42, 42, 42, - 42, 15, 42, 42, 42, 42, 42, 42, 42, 14, - 42, 42, 42, 42, 16, 17, 18, 42, 42, 42, - - 42, 42, 42, 42, 42, 42, 19, 26, 5, 42, - 42, 8, 42, 42, 42, 42, 24, 6, 11, 42, - 20, 21, 22, 42, 13, 23, 42, 42, 42, 9, - 10, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 27, 42, 42, 42, 42, 28, - 29, 42, 42, 42, 30, 31, 32, 42, 42, 42, - 42, 42, 33, 0 - } ; - -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, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 1, 1, 1, 1, 5, 1, - 1, 6, 7, 1, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 15, 17, 15, 1, 1, 18, - 1, 1, 1, 1, 19, 19, 19, 19, 20, 19, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 1, 1, 1, 1, 21, 1, 22, 23, 24, 25, - - 26, 27, 28, 29, 30, 21, 31, 32, 33, 34, - 35, 36, 21, 37, 38, 39, 40, 21, 41, 42, - 43, 21, 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, 1, 1 - } ; - -static yyconst int yy_meta[44] = - { 0, - 1, 1, 2, 1, 1, 1, 3, 4, 1, 5, - 5, 5, 5, 5, 5, 5, 5, 1, 6, 6, - 7, 6, 6, 6, 6, 6, 6, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 8, 7 - } ; - -static yyconst short int yy_base[173] = - { 0, - 0, 0, 209, 210, 210, 0, 210, 210, 200, 0, - 38, 37, 38, 210, 0, 16, 27, 26, 22, 24, - 181, 21, 163, 175, 0, 0, 196, 35, 210, 0, - 0, 0, 0, 0, 168, 176, 163, 178, 167, 171, - 162, 161, 159, 155, 150, 155, 161, 154, 155, 181, - 0, 0, 164, 164, 159, 147, 161, 160, 159, 147, - 144, 52, 137, 34, 138, 150, 136, 167, 166, 159, - 140, 0, 0, 132, 129, 129, 0, 130, 150, 153, - 150, 141, 127, 127, 136, 135, 133, 59, 145, 0, - 118, 123, 138, 114, 130, 129, 0, 113, 112, 120, - - 108, 117, 119, 128, 131, 128, 119, 0, 0, 101, - 125, 0, 101, 100, 99, 110, 0, 0, 0, 107, - 111, 44, 0, 95, 0, 0, 94, 93, 107, 0, - 0, 91, 90, 96, 88, 102, 101, 79, 84, 83, - 85, 96, 74, 72, 0, 83, 76, 58, 43, 0, - 0, 40, 39, 64, 0, 0, 0, 56, 40, 36, - 49, 24, 0, 210, 84, 89, 46, 91, 95, 103, - 107, 111 - } ; - -static yyconst short int yy_def[173] = - { 0, - 164, 1, 164, 164, 164, 165, 164, 164, 166, 167, - 164, 168, 168, 164, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 165, 167, 166, 167, 164, 170, - 28, 13, 171, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 172, - 170, 171, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 172, 172, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 0, 164, 164, 164, 164, 164, 164, - 164, 164 - } ; - -static yyconst short int yy_nxt[254] = - { 0, - 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, - 13, 13, 13, 13, 13, 13, 13, 14, 15, 15, - 15, 15, 16, 17, 18, 15, 19, 15, 15, 20, - 21, 15, 15, 15, 15, 15, 15, 22, 23, 24, - 15, 15, 15, 29, 31, 31, 30, 35, 37, 39, - 28, 40, 36, 41, 50, 38, 43, 44, 42, 46, - 50, 47, 79, 84, 80, 133, 163, 81, 82, 104, - 162, 105, 161, 85, 106, 107, 160, 159, 33, 164, - 158, 157, 156, 134, 25, 155, 25, 25, 25, 25, - 25, 25, 27, 27, 32, 32, 154, 153, 32, 34, - - 34, 34, 34, 51, 152, 51, 51, 51, 51, 51, - 51, 52, 52, 69, 151, 69, 150, 149, 148, 147, - 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, - 136, 135, 132, 131, 130, 129, 128, 127, 126, 125, - 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, - 114, 113, 112, 111, 110, 109, 108, 103, 102, 101, - 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, - 90, 89, 164, 164, 88, 87, 86, 83, 78, 77, - 76, 75, 74, 73, 72, 71, 70, 68, 67, 66, - 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, - - 55, 54, 53, 31, 49, 48, 45, 26, 164, 3, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164 - } ; - -static yyconst short int yy_chk[254] = - { 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, 11, 12, 13, 11, 16, 17, 18, - 167, 18, 16, 19, 28, 17, 20, 20, 19, 22, - 28, 22, 62, 64, 62, 122, 162, 62, 62, 88, - 161, 88, 160, 64, 88, 88, 159, 158, 12, 13, - 154, 153, 152, 122, 165, 149, 165, 165, 165, 165, - 165, 165, 166, 166, 168, 168, 148, 147, 168, 169, - - 169, 169, 169, 170, 146, 170, 170, 170, 170, 170, - 170, 171, 171, 172, 144, 172, 143, 142, 141, 140, - 139, 138, 137, 136, 135, 134, 133, 132, 129, 128, - 127, 124, 121, 120, 116, 115, 114, 113, 111, 110, - 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, - 96, 95, 94, 93, 92, 91, 89, 87, 86, 85, - 84, 83, 82, 81, 80, 79, 78, 76, 75, 74, - 71, 70, 69, 68, 67, 66, 65, 63, 61, 60, - 59, 58, 57, 56, 55, 54, 53, 50, 49, 48, - 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, - - 37, 36, 35, 27, 24, 23, 21, 9, 3, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "dcLexer.lxx" -#define INITIAL 0 -/* -// Filename: dcLexer.lxx -// Created by: drose (05Oct00) -// -//////////////////////////////////////////////////////////////////// -*/ -#line 9 "dcLexer.lxx" -#include "dcLexerDefs.h" -#include "dcParserDefs.h" -#include "dcParser.h" -#include "dcFile.h" -#include "dcindent.h" - - -static int yyinput(void); // declared by flex. -extern "C" int dcyywrap(); - -//////////////////////////////////////////////////////////////////// -// Static variables -//////////////////////////////////////////////////////////////////// - -// We'll increment line_number and col_number as we parse the file, so -// that we can report the position of an error. -static int line_number = 0; -static int col_number = 0; - -// current_line holds as much of the current line as will fit. Its -// only purpose is for printing it out to report an error to the user. -static const int max_error_width = 1024; -static char current_line[max_error_width + 1]; - -static int error_count = 0; -static int warning_count = 0; - -// This is the pointer to the current input stream. -static istream *inp = NULL; - -// This is the name of the dc file we're parsing. We keep it so we -// can print it out for error messages. -static string dc_filename; - -// This is the initial token state returned by the lexer. It allows -// the yacc grammar to start from initial points. -static int initial_token; - - -//////////////////////////////////////////////////////////////////// -// Defining the interface to the lexer. -//////////////////////////////////////////////////////////////////// - -void -dc_init_lexer(istream &in, const string &filename) { - inp = ∈ - dc_filename = filename; - line_number = 0; - col_number = 0; - error_count = 0; - warning_count = 0; - initial_token = START_DC; -} - -void -dc_start_parameter_value() { - /* Set the initial state to begin parsing a parameter value, instead - of at the beginning of the dc file. */ - initial_token = START_PARAMETER_VALUE; -} - -void -dc_start_parameter_description() { - /* Set the initial state to begin parsing a parameter description, instead - of at the beginning of the dc file. */ - initial_token = START_PARAMETER_DESCRIPTION; -} - -int -dc_error_count() { - return error_count; -} - -int -dc_warning_count() { - return warning_count; -} - - -//////////////////////////////////////////////////////////////////// -// Internal support functions. -//////////////////////////////////////////////////////////////////// - -int -dcyywrap(void) { - return 1; -} - -void -dcyyerror(const string &msg) { - cerr << "\nError"; - if (!dc_filename.empty()) { - cerr << " in " << dc_filename; - } - cerr - << " at line " << line_number << ", column " << col_number << ":\n" - << current_line << "\n"; - indent(cerr, col_number-1) - << "^\n" << msg << "\n\n"; - - error_count++; -} - -void -dcyywarning(const string &msg) { - cerr << "\nWarning"; - if (!dc_filename.empty()) { - cerr << " in " << dc_filename; - } - cerr - << " at line " << line_number << ", column " << col_number << ":\n" - << current_line << "\n"; - indent(cerr, col_number-1) - << "^\n" << msg << "\n\n"; - - warning_count++; -} - -// Now define a function to take input from an istream instead of a -// stdio FILE pointer. This is flex-specific. -static void -input_chars(char *buffer, int &result, int max_size) { - nassertv(inp != NULL); - if (*inp) { - inp->read(buffer, max_size); - result = inp->gcount(); - if (result >= 0 && result < max_size) { - // Truncate at the end of the read. - buffer[result] = '\0'; - } - - if (line_number == 0) { - // This is a special case. If we are reading the very first bit - // from the stream, copy it into the current_line array. This - // is because the \n.* rule below, which fills current_line - // normally, doesn't catch the first line. - strncpy(current_line, dcyytext, max_error_width); - current_line[max_error_width] = '\0'; - line_number++; - col_number = 0; - - // Truncate it at the newline. - char *end = strchr(current_line, '\n'); - if (end != NULL) { - *end = '\0'; - } - } - - } else { - // End of file or I/O error. - result = 0; - } -} -#undef YY_INPUT -#define YY_INPUT(buffer, result, max_size) input_chars(buffer, result, max_size) - -// read_char reads and returns a single character, incrementing the -// supplied line and column numbers as appropriate. A convenience -// function for the scanning functions below. -static int -read_char(int &line, int &col) { - int c = yyinput(); - if (c == '\n') { - line++; - col = 0; - } else { - col++; - } - return c; -} - -// scan_quoted_string reads a string delimited by quotation marks and -// returns it. -static string -scan_quoted_string(char quote_mark) { - string result; - - // We don't touch the current line number and column number during - // scanning, so that if we detect an error while scanning the string - // (e.g. an unterminated string), we'll report the error as - // occurring at the start of the string, not at the end--somewhat - // more convenient for the user. - - // Instead of adjusting the global line_number and col_number - // variables, we'll operate on our own local variables for the - // interim. - int line = line_number; - int col = col_number; - - int c; - c = read_char(line, col); - while (c != quote_mark && c != EOF) { - // A newline is not allowed within a string unless it is escaped. - if (c == '\n') { - c = EOF; - break; - - } else if (c == '\\') { - // Backslash escapes the following character. We also respect - // some C conventions. - c = read_char(line, col); - switch (c) { - case 'a': - result += '\a'; - c = read_char(line, col); - break; - - case 'n': - result += '\n'; - c = read_char(line, col); - break; - - case 'r': - result += '\r'; - c = read_char(line, col); - break; - - case 't': - result += '\t'; - c = read_char(line, col); - break; - - case 'x': - { - int hex = 0; - c = read_char(line, col); - for (int i = 0; i < 2 && isxdigit(c); i++) { - hex = hex * 16 + (isdigit(c) ? c - '0' : tolower(c) - 'a' + 10); - c = read_char(line, col); - } - - result += hex; - } - break; - - case '0': - { - int oct = 0; - c = read_char(line, col); - for (int i = 0; i < 3 && (c >= '0' && c < '7'); i++) { - oct = oct * 8 + (c - '0'); - c = read_char(line, col); - } - - result += oct; - } - break; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { - int dec = 0; - c = read_char(line, col); - for (int i = 0; i < 3 && isdigit(c); i++) { - dec = dec * 10 + (c - '0'); - c = read_char(line, col); - } - - result += dec; - } - break; - - case EOF: - break; - - default: - result += c; - c = read_char(line, col); - } - - } else { - result += c; - c = read_char(line, col); - } - } - - if (c == EOF) { - dcyyerror("This quotation mark is unterminated."); - } - - line_number = line; - col_number = col; - - return result; -} - -// scan_hex_string reads a string of hexadecimal digits delimited by -// angle brackets and returns the representative string. -static string -scan_hex_string() { - string result; - - // We don't touch the current line number and column number during - // scanning, so that if we detect an error while scanning the string - // (e.g. an unterminated string), we'll report the error as - // occurring at the start of the string, not at the end--somewhat - // more convenient for the user. - - // Instead of adjusting the global line_number and col_number - // variables, we'll operate on our own local variables for the - // interim. - int line = line_number; - int col = col_number; - - bool odd = false; - int last = 0; - int c; - c = read_char(line, col); - while (c != '>' && c != EOF) { - int value; - if (c >= '0' && c <= '9') { - value = c - '0'; - } else if (c >= 'a' && c <= 'f') { - value = c - 'a' + 10; - } else if (c >= 'A' && c <= 'F') { - value = c - 'A' + 10; - } else { - line_number = line; - col_number = col; - dcyyerror("Invalid hex digit."); - return string(); - } - - odd = !odd; - if (odd) { - last = value; - } else { - result += (char)((last << 4) | value); - } - c = read_char(line, col); - } - - if (c == EOF) { - dcyyerror("This hex string is unterminated."); - return string(); - } else if (odd) { - dcyyerror("Odd number of hex digits."); - return string(); - } - - line_number = line; - col_number = col; - - return result; -} - -// eat_c_comment scans past all characters up until the first */ -// encountered. -static void -eat_c_comment() { - // As above, we'll operate on our own local copies of line_number - // and col_number within this function. - - int line = line_number; - int col = col_number; - - int c, last_c; - - last_c = '\0'; - c = read_char(line, col); - while (c != EOF && !(last_c == '*' && c == '/')) { - if (last_c == '/' && c == '*') { - dcyywarning("This comment contains a nested /* symbol--possibly unclosed?"); - } - last_c = c; - c = read_char(line, col); - } - - if (c == EOF) { - dcyyerror("This comment marker is unclosed."); - } - - line_number = line; - col_number = col; -} - - - -// accept() is called below as each piece is pulled off and -// accepted by the lexer; it increments the current column number. -inline void accept() { - col_number += yyleng; -} - -#line 891 "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 = NULL, *yy_bp = NULL; - register int yy_act; - -#line 407 "dcLexer.lxx" - - - - if (initial_token != 0) { - int t = initial_token; - initial_token = 0; - return t; - } - - -#line 1053 "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_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = 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 >= 165 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 210 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 417 "dcLexer.lxx" -{ - // New line. Save a copy of the line so we can print it out for the - // benefit of the user in case we get an error. - - strncpy(current_line, dcyytext+1, max_error_width); - current_line[max_error_width] = '\0'; - line_number++; - col_number=0; - - // Return the whole line to the lexer, except the newline character, - // which we eat. - yyless(1); -} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 431 "dcLexer.lxx" -{ - // Eat whitespace. - accept(); -} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 436 "dcLexer.lxx" -{ - // Eat C++-style comments. - accept(); -} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 441 "dcLexer.lxx" -{ - // Eat C-style comments. - accept(); - eat_c_comment(); -} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 448 "dcLexer.lxx" -{ - accept(); - return KW_DCLASS; -} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 453 "dcLexer.lxx" -{ - accept(); - return KW_STRUCT; -} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 458 "dcLexer.lxx" -{ - accept(); - return KW_FROM; -} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 463 "dcLexer.lxx" -{ - accept(); - return KW_IMPORT; -} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 468 "dcLexer.lxx" -{ - accept(); - return KW_KEYWORD; -} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 473 "dcLexer.lxx" -{ - accept(); - return KW_TYPEDEF; -} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 478 "dcLexer.lxx" -{ - accept(); - return KW_SWITCH; -} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 483 "dcLexer.lxx" -{ - accept(); - return KW_CASE; -} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 488 "dcLexer.lxx" -{ - accept(); - return KW_DEFAULT; -} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 493 "dcLexer.lxx" -{ - accept(); - return KW_BREAK; -} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 498 "dcLexer.lxx" -{ - accept(); - return KW_INT8; -} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 503 "dcLexer.lxx" -{ - accept(); - return KW_INT16; -} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 508 "dcLexer.lxx" -{ - accept(); - return KW_INT32; -} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 513 "dcLexer.lxx" -{ - accept(); - return KW_INT64; -} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 518 "dcLexer.lxx" -{ - accept(); - return KW_UINT8; -} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 523 "dcLexer.lxx" -{ - accept(); - return KW_UINT16; -} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 528 "dcLexer.lxx" -{ - accept(); - return KW_UINT32; -} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 533 "dcLexer.lxx" -{ - accept(); - return KW_UINT64; -} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 538 "dcLexer.lxx" -{ - accept(); - return KW_FLOAT64; -} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 543 "dcLexer.lxx" -{ - accept(); - return KW_STRING; -} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 548 "dcLexer.lxx" -{ - accept(); - return KW_BLOB; -} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 553 "dcLexer.lxx" -{ - accept(); - return KW_BLOB32; -} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 558 "dcLexer.lxx" -{ - accept(); - return KW_INT8ARRAY; -} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 563 "dcLexer.lxx" -{ - accept(); - return KW_INT16ARRAY; -} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 568 "dcLexer.lxx" -{ - accept(); - return KW_INT32ARRAY; -} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 573 "dcLexer.lxx" -{ - accept(); - return KW_UINT8ARRAY; -} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 578 "dcLexer.lxx" -{ - accept(); - return KW_UINT16ARRAY; -} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 583 "dcLexer.lxx" -{ - accept(); - return KW_UINT32ARRAY; -} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 588 "dcLexer.lxx" -{ - accept(); - return KW_UINT32UINT8ARRAY; -} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 593 "dcLexer.lxx" -{ - accept(); - return KW_CHAR; -} - YY_BREAK -case 35: -YY_RULE_SETUP -#line 598 "dcLexer.lxx" -{ - // An unsigned integer number. - accept(); - - // atoll isn't fully portable, so we'll decode the integer by hand. - dcyylval.str = dcyytext; - dcyylval.u.uint64 = 0; - const char *p = dcyytext; - while (*p != '\0') { - PN_uint64 next_value = dcyylval.u.uint64 * 10; - if (next_value < dcyylval.u.uint64) { - dcyyerror("Number out of range."); - dcyylval.u.uint64 = 1; - return UNSIGNED_INTEGER; - } - - dcyylval.u.uint64 = next_value + (*p - '0'); - ++p; - } - - return UNSIGNED_INTEGER; -} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 621 "dcLexer.lxx" -{ - // A signed integer number. - accept(); - - // atoll isn't fully portable, so we'll decode the integer by hand. - dcyylval.str = dcyytext; - - bool neg = false; - const char *p = dcyytext; - if (*p == '-') { - neg = true; - ++p; - } else if (*p == '+') { - ++p; - } - - PN_uint64 value = 0; - while (*p != '\0') { - PN_uint64 next_value = value * 10; - if (next_value < value) { - dcyyerror("Number out of range."); - dcyylval.u.int64 = 1; - return SIGNED_INTEGER; - } - - value = next_value + (*p - '0'); - ++p; - } - - if (neg) { - dcyylval.u.int64 = -(PN_int64)value; - if (dcyylval.u.int64 > 0) { - dcyyerror("Number out of range."); - dcyylval.u.int64 = 1; - } - } else { - dcyylval.u.int64 = (PN_int64)value; - if (dcyylval.u.int64 < 0) { - dcyyerror("Number out of range."); - dcyylval.u.int64 = 1; - } - } - - return SIGNED_INTEGER; -} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 667 "dcLexer.lxx" -{ - // A hexadecimal integer number. - accept(); - - // As above, we'll decode the hex string by hand. - dcyylval.str = dcyytext; - dcyylval.u.uint64 = 0; - const char *p = dcyytext + 2; - while (*p != '\0') { - PN_uint64 next_value = dcyylval.u.uint64 * 16; - if (next_value < dcyylval.u.uint64) { - dcyyerror("Number out of range."); - dcyylval.u.uint64 = 1; - return UNSIGNED_INTEGER; - } - - if (isalpha(*p)) { - dcyylval.u.uint64 = next_value + (tolower(*p) - 'a' + 10); - } else { - dcyylval.u.uint64 = next_value + (*p - '0'); - } - ++p; - } - - return UNSIGNED_INTEGER; -} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 694 "dcLexer.lxx" -{ - // A floating-point number. - accept(); - dcyylval.u.real = atof(dcyytext); - dcyylval.str = dcyytext; - return REAL; -} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 702 "dcLexer.lxx" -{ - // Quoted string. - accept(); - dcyylval.str = scan_quoted_string('"'); - return STRING; -} - YY_BREAK -case 40: -YY_RULE_SETUP -#line 709 "dcLexer.lxx" -{ - // Single-quoted string. - accept(); - dcyylval.str = scan_quoted_string('\''); - return STRING; -} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 716 "dcLexer.lxx" -{ - // Long hex string. - accept(); - dcyylval.str = scan_hex_string(); - return HEX_STRING; -} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 723 "dcLexer.lxx" -{ - // Identifier or keyword. - accept(); - dcyylval.str = dcyytext; - - if (dc_file != (DCFile *)NULL) { - const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str); - if (keyword != (DCKeyword *)NULL) { - dcyylval.u.keyword = keyword; - return KEYWORD; - } - } - return IDENTIFIER; -} - YY_BREAK -case 43: -YY_RULE_SETUP -#line 739 "dcLexer.lxx" -{ - // Send any other printable character as itself. - accept(); - return dcyytext[0]; -} - YY_BREAK -case 44: -YY_RULE_SETUP -#line 745 "dcLexer.lxx" -ECHO; - YY_BREAK -#line 1596 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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; - - 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); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = 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 >= 165 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - 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 char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = 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 >= 165 ) - 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 == 164); - - 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; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifndef YY_NO_INPUT -#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; - - - return c; - } -#endif /* YY_NO_INPUT */ - -#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 ); - } - - - -#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 745 "dcLexer.lxx" +#define yy_create_buffer dcyy_create_buffer +#define yy_delete_buffer dcyy_delete_buffer +#define yy_scan_buffer dcyy_scan_buffer +#define yy_scan_string dcyy_scan_string +#define yy_scan_bytes dcyy_scan_bytes +#define yy_flex_debug dcyy_flex_debug +#define yy_init_buffer dcyy_init_buffer +#define yy_flush_buffer dcyy_flush_buffer +#define yy_load_buffer_state dcyy_load_buffer_state +#define yy_switch_to_buffer dcyy_switch_to_buffer +#define yyin dcyyin +#define yyleng dcyyleng +#define yylex dcyylex +#define yyout dcyyout +#define yyrestart dcyyrestart +#define yytext dcyytext +#define yywrap dcyywrap + +#line 20 "lex.yy.c" +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header$ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#include + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#ifndef _WIN32 +#endif + +/* 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) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +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 44 +#define YY_END_OF_BUFFER 45 +static yyconst short int yy_accept[165] = + { 0, + 0, 0, 45, 43, 2, 1, 39, 40, 43, 43, + 43, 35, 35, 41, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 1, 0, 36, 38, 4, 3, + 38, 35, 37, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, + 3, 37, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 0, 38, 25, + 42, 12, 34, 42, 42, 42, 7, 42, 42, 42, + 42, 15, 42, 42, 42, 42, 42, 42, 42, 14, + 42, 42, 42, 42, 16, 17, 18, 42, 42, 42, + + 42, 42, 42, 42, 42, 42, 19, 26, 5, 42, + 42, 8, 42, 42, 42, 42, 24, 6, 11, 42, + 20, 21, 22, 42, 13, 23, 42, 42, 42, 9, + 10, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 27, 42, 42, 42, 42, 28, + 29, 42, 42, 42, 30, 31, 32, 42, 42, 42, + 42, 42, 33, 0 + } ; + +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, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 1, 1, 1, 5, 1, + 1, 6, 7, 1, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 15, 17, 15, 1, 1, 18, + 1, 1, 1, 1, 19, 19, 19, 19, 20, 19, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 1, 1, 1, 1, 21, 1, 22, 23, 24, 25, + + 26, 27, 28, 29, 30, 21, 31, 32, 33, 34, + 35, 36, 21, 37, 38, 39, 40, 21, 41, 42, + 43, 21, 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, 1, 1 + } ; + +static yyconst int yy_meta[44] = + { 0, + 1, 1, 2, 1, 1, 1, 3, 4, 1, 5, + 5, 5, 5, 5, 5, 5, 5, 1, 6, 6, + 7, 6, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 7 + } ; + +static yyconst short int yy_base[173] = + { 0, + 0, 0, 209, 210, 210, 0, 210, 210, 200, 0, + 38, 37, 38, 210, 0, 16, 27, 26, 22, 24, + 181, 21, 163, 175, 0, 0, 196, 35, 210, 0, + 0, 0, 0, 0, 168, 176, 163, 178, 167, 171, + 162, 161, 159, 155, 150, 155, 161, 154, 155, 181, + 0, 0, 164, 164, 159, 147, 161, 160, 159, 147, + 144, 52, 137, 34, 138, 150, 136, 167, 166, 159, + 140, 0, 0, 132, 129, 129, 0, 130, 150, 153, + 150, 141, 127, 127, 136, 135, 133, 59, 145, 0, + 118, 123, 138, 114, 130, 129, 0, 113, 112, 120, + + 108, 117, 119, 128, 131, 128, 119, 0, 0, 101, + 125, 0, 101, 100, 99, 110, 0, 0, 0, 107, + 111, 44, 0, 95, 0, 0, 94, 93, 107, 0, + 0, 91, 90, 96, 88, 102, 101, 79, 84, 83, + 85, 96, 74, 72, 0, 83, 76, 58, 43, 0, + 0, 40, 39, 64, 0, 0, 0, 56, 40, 36, + 49, 24, 0, 210, 84, 89, 46, 91, 95, 103, + 107, 111 + } ; + +static yyconst short int yy_def[173] = + { 0, + 164, 1, 164, 164, 164, 165, 164, 164, 166, 167, + 164, 168, 168, 164, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 165, 167, 166, 167, 164, 170, + 28, 13, 171, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 172, + 170, 171, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 172, 172, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 0, 164, 164, 164, 164, 164, 164, + 164, 164 + } ; + +static yyconst short int yy_nxt[254] = + { 0, + 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, + 13, 13, 13, 13, 13, 13, 13, 14, 15, 15, + 15, 15, 16, 17, 18, 15, 19, 15, 15, 20, + 21, 15, 15, 15, 15, 15, 15, 22, 23, 24, + 15, 15, 15, 29, 31, 31, 30, 35, 37, 39, + 28, 40, 36, 41, 50, 38, 43, 44, 42, 46, + 50, 47, 79, 84, 80, 133, 163, 81, 82, 104, + 162, 105, 161, 85, 106, 107, 160, 159, 33, 164, + 158, 157, 156, 134, 25, 155, 25, 25, 25, 25, + 25, 25, 27, 27, 32, 32, 154, 153, 32, 34, + + 34, 34, 34, 51, 152, 51, 51, 51, 51, 51, + 51, 52, 52, 69, 151, 69, 150, 149, 148, 147, + 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, + 136, 135, 132, 131, 130, 129, 128, 127, 126, 125, + 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, + 114, 113, 112, 111, 110, 109, 108, 103, 102, 101, + 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, + 90, 89, 164, 164, 88, 87, 86, 83, 78, 77, + 76, 75, 74, 73, 72, 71, 70, 68, 67, 66, + 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, + + 55, 54, 53, 31, 49, 48, 45, 26, 164, 3, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164 + } ; + +static yyconst short int yy_chk[254] = + { 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, 11, 12, 13, 11, 16, 17, 18, + 167, 18, 16, 19, 28, 17, 20, 20, 19, 22, + 28, 22, 62, 64, 62, 122, 162, 62, 62, 88, + 161, 88, 160, 64, 88, 88, 159, 158, 12, 13, + 154, 153, 152, 122, 165, 149, 165, 165, 165, 165, + 165, 165, 166, 166, 168, 168, 148, 147, 168, 169, + + 169, 169, 169, 170, 146, 170, 170, 170, 170, 170, + 170, 171, 171, 172, 144, 172, 143, 142, 141, 140, + 139, 138, 137, 136, 135, 134, 133, 132, 129, 128, + 127, 124, 121, 120, 116, 115, 114, 113, 111, 110, + 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, + 96, 95, 94, 93, 92, 91, 89, 87, 86, 85, + 84, 83, 82, 81, 80, 79, 78, 76, 75, 74, + 71, 70, 69, 68, 67, 66, 65, 63, 61, 60, + 59, 58, 57, 56, 55, 54, 53, 50, 49, 48, + 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, + + 37, 36, 35, 27, 24, 23, 21, 9, 3, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "dcLexer.lxx" +#define INITIAL 0 +/* +// Filename: dcLexer.lxx +// Created by: drose (05Oct00) +// +//////////////////////////////////////////////////////////////////// +*/ +#line 9 "dcLexer.lxx" +#include "dcLexerDefs.h" +#include "dcParserDefs.h" +#include "dcParser.h" +#include "dcFile.h" +#include "dcindent.h" + + +static int yyinput(void); // declared by flex. +extern "C" int dcyywrap(); + +//////////////////////////////////////////////////////////////////// +// Static variables +//////////////////////////////////////////////////////////////////// + +// We'll increment line_number and col_number as we parse the file, so +// that we can report the position of an error. +static int line_number = 0; +static int col_number = 0; + +// current_line holds as much of the current line as will fit. Its +// only purpose is for printing it out to report an error to the user. +static const int max_error_width = 1024; +static char current_line[max_error_width + 1]; + +static int error_count = 0; +static int warning_count = 0; + +// This is the pointer to the current input stream. +static istream *inp = NULL; + +// This is the name of the dc file we're parsing. We keep it so we +// can print it out for error messages. +static string dc_filename; + +// This is the initial token state returned by the lexer. It allows +// the yacc grammar to start from initial points. +static int initial_token; + + +//////////////////////////////////////////////////////////////////// +// Defining the interface to the lexer. +//////////////////////////////////////////////////////////////////// + +void +dc_init_lexer(istream &in, const string &filename) { + inp = ∈ + dc_filename = filename; + line_number = 0; + col_number = 0; + error_count = 0; + warning_count = 0; + initial_token = START_DC; +} + +void +dc_start_parameter_value() { + /* Set the initial state to begin parsing a parameter value, instead + of at the beginning of the dc file. */ + initial_token = START_PARAMETER_VALUE; +} + +void +dc_start_parameter_description() { + /* Set the initial state to begin parsing a parameter description, instead + of at the beginning of the dc file. */ + initial_token = START_PARAMETER_DESCRIPTION; +} + +int +dc_error_count() { + return error_count; +} + +int +dc_warning_count() { + return warning_count; +} + + +//////////////////////////////////////////////////////////////////// +// Internal support functions. +//////////////////////////////////////////////////////////////////// + +int +dcyywrap(void) { + return 1; +} + +void +dcyyerror(const string &msg) { + cerr << "\nError"; + if (!dc_filename.empty()) { + cerr << " in " << dc_filename; + } + cerr + << " at line " << line_number << ", column " << col_number << ":\n" + << current_line << "\n"; + indent(cerr, col_number-1) + << "^\n" << msg << "\n\n"; + + error_count++; +} + +void +dcyywarning(const string &msg) { + cerr << "\nWarning"; + if (!dc_filename.empty()) { + cerr << " in " << dc_filename; + } + cerr + << " at line " << line_number << ", column " << col_number << ":\n" + << current_line << "\n"; + indent(cerr, col_number-1) + << "^\n" << msg << "\n\n"; + + warning_count++; +} + +// Now define a function to take input from an istream instead of a +// stdio FILE pointer. This is flex-specific. +static void +input_chars(char *buffer, int &result, int max_size) { + nassertv(inp != NULL); + if (*inp) { + inp->read(buffer, max_size); + result = inp->gcount(); + if (result >= 0 && result < max_size) { + // Truncate at the end of the read. + buffer[result] = '\0'; + } + + if (line_number == 0) { + // This is a special case. If we are reading the very first bit + // from the stream, copy it into the current_line array. This + // is because the \n.* rule below, which fills current_line + // normally, doesn't catch the first line. + strncpy(current_line, dcyytext, max_error_width); + current_line[max_error_width] = '\0'; + line_number++; + col_number = 0; + + // Truncate it at the newline. + char *end = strchr(current_line, '\n'); + if (end != NULL) { + *end = '\0'; + } + } + + } else { + // End of file or I/O error. + result = 0; + } +} +#undef YY_INPUT +#define YY_INPUT(buffer, result, max_size) input_chars(buffer, result, max_size) + +// read_char reads and returns a single character, incrementing the +// supplied line and column numbers as appropriate. A convenience +// function for the scanning functions below. +static int +read_char(int &line, int &col) { + int c = yyinput(); + if (c == '\n') { + line++; + col = 0; + } else { + col++; + } + return c; +} + +// scan_quoted_string reads a string delimited by quotation marks and +// returns it. +static string +scan_quoted_string(char quote_mark) { + string result; + + // We don't touch the current line number and column number during + // scanning, so that if we detect an error while scanning the string + // (e.g. an unterminated string), we'll report the error as + // occurring at the start of the string, not at the end--somewhat + // more convenient for the user. + + // Instead of adjusting the global line_number and col_number + // variables, we'll operate on our own local variables for the + // interim. + int line = line_number; + int col = col_number; + + int c; + c = read_char(line, col); + while (c != quote_mark && c != EOF) { + // A newline is not allowed within a string unless it is escaped. + if (c == '\n') { + c = EOF; + break; + + } else if (c == '\\') { + // Backslash escapes the following character. We also respect + // some C conventions. + c = read_char(line, col); + switch (c) { + case 'a': + result += '\a'; + c = read_char(line, col); + break; + + case 'n': + result += '\n'; + c = read_char(line, col); + break; + + case 'r': + result += '\r'; + c = read_char(line, col); + break; + + case 't': + result += '\t'; + c = read_char(line, col); + break; + + case 'x': + { + int hex = 0; + c = read_char(line, col); + for (int i = 0; i < 2 && isxdigit(c); i++) { + hex = hex * 16 + (isdigit(c) ? c - '0' : tolower(c) - 'a' + 10); + c = read_char(line, col); + } + + result += hex; + } + break; + + case '0': + { + int oct = 0; + c = read_char(line, col); + for (int i = 0; i < 3 && (c >= '0' && c < '7'); i++) { + oct = oct * 8 + (c - '0'); + c = read_char(line, col); + } + + result += oct; + } + break; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + int dec = 0; + c = read_char(line, col); + for (int i = 0; i < 3 && isdigit(c); i++) { + dec = dec * 10 + (c - '0'); + c = read_char(line, col); + } + + result += dec; + } + break; + + case EOF: + break; + + default: + result += c; + c = read_char(line, col); + } + + } else { + result += c; + c = read_char(line, col); + } + } + + if (c == EOF) { + dcyyerror("This quotation mark is unterminated."); + } + + line_number = line; + col_number = col; + + return result; +} + +// scan_hex_string reads a string of hexadecimal digits delimited by +// angle brackets and returns the representative string. +static string +scan_hex_string() { + string result; + + // We don't touch the current line number and column number during + // scanning, so that if we detect an error while scanning the string + // (e.g. an unterminated string), we'll report the error as + // occurring at the start of the string, not at the end--somewhat + // more convenient for the user. + + // Instead of adjusting the global line_number and col_number + // variables, we'll operate on our own local variables for the + // interim. + int line = line_number; + int col = col_number; + + bool odd = false; + int last = 0; + int c; + c = read_char(line, col); + while (c != '>' && c != EOF) { + int value; + if (c >= '0' && c <= '9') { + value = c - '0'; + } else if (c >= 'a' && c <= 'f') { + value = c - 'a' + 10; + } else if (c >= 'A' && c <= 'F') { + value = c - 'A' + 10; + } else { + line_number = line; + col_number = col; + dcyyerror("Invalid hex digit."); + return string(); + } + + odd = !odd; + if (odd) { + last = value; + } else { + result += (char)((last << 4) | value); + } + c = read_char(line, col); + } + + if (c == EOF) { + dcyyerror("This hex string is unterminated."); + return string(); + } else if (odd) { + dcyyerror("Odd number of hex digits."); + return string(); + } + + line_number = line; + col_number = col; + + return result; +} + +// eat_c_comment scans past all characters up until the first */ +// encountered. +static void +eat_c_comment() { + // As above, we'll operate on our own local copies of line_number + // and col_number within this function. + + int line = line_number; + int col = col_number; + + int c, last_c; + + last_c = '\0'; + c = read_char(line, col); + while (c != EOF && !(last_c == '*' && c == '/')) { + if (last_c == '/' && c == '*') { + dcyywarning("This comment contains a nested /* symbol--possibly unclosed?"); + } + last_c = c; + c = read_char(line, col); + } + + if (c == EOF) { + dcyyerror("This comment marker is unclosed."); + } + + line_number = line; + col_number = col; +} + + + +// accept() is called below as each piece is pulled off and +// accepted by the lexer; it increments the current column number. +inline void accept() { + col_number += yyleng; +} + +#line 894 "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 \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#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 407 "dcLexer.lxx" + + + + if (initial_token != 0) { + int t = initial_token; + initial_token = 0; + return t; + } + + +#line 1067 "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_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = 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 >= 165 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 210 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 417 "dcLexer.lxx" +{ + // New line. Save a copy of the line so we can print it out for the + // benefit of the user in case we get an error. + + strncpy(current_line, dcyytext+1, max_error_width); + current_line[max_error_width] = '\0'; + line_number++; + col_number=0; + + // Return the whole line to the lexer, except the newline character, + // which we eat. + yyless(1); +} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 431 "dcLexer.lxx" +{ + // Eat whitespace. + accept(); +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 436 "dcLexer.lxx" +{ + // Eat C++-style comments. + accept(); +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 441 "dcLexer.lxx" +{ + // Eat C-style comments. + accept(); + eat_c_comment(); +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 448 "dcLexer.lxx" +{ + accept(); + return KW_DCLASS; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 453 "dcLexer.lxx" +{ + accept(); + return KW_STRUCT; +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 458 "dcLexer.lxx" +{ + accept(); + return KW_FROM; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 463 "dcLexer.lxx" +{ + accept(); + return KW_IMPORT; +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 468 "dcLexer.lxx" +{ + accept(); + return KW_KEYWORD; +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 473 "dcLexer.lxx" +{ + accept(); + return KW_TYPEDEF; +} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 478 "dcLexer.lxx" +{ + accept(); + return KW_SWITCH; +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 483 "dcLexer.lxx" +{ + accept(); + return KW_CASE; +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 488 "dcLexer.lxx" +{ + accept(); + return KW_DEFAULT; +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 493 "dcLexer.lxx" +{ + accept(); + return KW_BREAK; +} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 498 "dcLexer.lxx" +{ + accept(); + return KW_INT8; +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 503 "dcLexer.lxx" +{ + accept(); + return KW_INT16; +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 508 "dcLexer.lxx" +{ + accept(); + return KW_INT32; +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 513 "dcLexer.lxx" +{ + accept(); + return KW_INT64; +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 518 "dcLexer.lxx" +{ + accept(); + return KW_UINT8; +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 523 "dcLexer.lxx" +{ + accept(); + return KW_UINT16; +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 528 "dcLexer.lxx" +{ + accept(); + return KW_UINT32; +} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 533 "dcLexer.lxx" +{ + accept(); + return KW_UINT64; +} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 538 "dcLexer.lxx" +{ + accept(); + return KW_FLOAT64; +} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 543 "dcLexer.lxx" +{ + accept(); + return KW_STRING; +} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 548 "dcLexer.lxx" +{ + accept(); + return KW_BLOB; +} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 553 "dcLexer.lxx" +{ + accept(); + return KW_BLOB32; +} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 558 "dcLexer.lxx" +{ + accept(); + return KW_INT8ARRAY; +} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 563 "dcLexer.lxx" +{ + accept(); + return KW_INT16ARRAY; +} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 568 "dcLexer.lxx" +{ + accept(); + return KW_INT32ARRAY; +} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 573 "dcLexer.lxx" +{ + accept(); + return KW_UINT8ARRAY; +} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 578 "dcLexer.lxx" +{ + accept(); + return KW_UINT16ARRAY; +} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 583 "dcLexer.lxx" +{ + accept(); + return KW_UINT32ARRAY; +} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 588 "dcLexer.lxx" +{ + accept(); + return KW_UINT32UINT8ARRAY; +} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 593 "dcLexer.lxx" +{ + accept(); + return KW_CHAR; +} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 598 "dcLexer.lxx" +{ + // An unsigned integer number. + accept(); + + // atoll isn't fully portable, so we'll decode the integer by hand. + dcyylval.str = dcyytext; + dcyylval.u.uint64 = 0; + const char *p = dcyytext; + while (*p != '\0') { + PN_uint64 next_value = dcyylval.u.uint64 * 10; + if (next_value < dcyylval.u.uint64) { + dcyyerror("Number out of range."); + dcyylval.u.uint64 = 1; + return UNSIGNED_INTEGER; + } + + dcyylval.u.uint64 = next_value + (*p - '0'); + ++p; + } + + return UNSIGNED_INTEGER; +} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 621 "dcLexer.lxx" +{ + // A signed integer number. + accept(); + + // atoll isn't fully portable, so we'll decode the integer by hand. + dcyylval.str = dcyytext; + + bool neg = false; + const char *p = dcyytext; + if (*p == '-') { + neg = true; + ++p; + } else if (*p == '+') { + ++p; + } + + PN_uint64 value = 0; + while (*p != '\0') { + PN_uint64 next_value = value * 10; + if (next_value < value) { + dcyyerror("Number out of range."); + dcyylval.u.int64 = 1; + return SIGNED_INTEGER; + } + + value = next_value + (*p - '0'); + ++p; + } + + if (neg) { + dcyylval.u.int64 = -(PN_int64)value; + if (dcyylval.u.int64 > 0) { + dcyyerror("Number out of range."); + dcyylval.u.int64 = 1; + } + } else { + dcyylval.u.int64 = (PN_int64)value; + if (dcyylval.u.int64 < 0) { + dcyyerror("Number out of range."); + dcyylval.u.int64 = 1; + } + } + + return SIGNED_INTEGER; +} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 667 "dcLexer.lxx" +{ + // A hexadecimal integer number. + accept(); + + // As above, we'll decode the hex string by hand. + dcyylval.str = dcyytext; + dcyylval.u.uint64 = 0; + const char *p = dcyytext + 2; + while (*p != '\0') { + PN_uint64 next_value = dcyylval.u.uint64 * 16; + if (next_value < dcyylval.u.uint64) { + dcyyerror("Number out of range."); + dcyylval.u.uint64 = 1; + return UNSIGNED_INTEGER; + } + + if (isalpha(*p)) { + dcyylval.u.uint64 = next_value + (tolower(*p) - 'a' + 10); + } else { + dcyylval.u.uint64 = next_value + (*p - '0'); + } + ++p; + } + + return UNSIGNED_INTEGER; +} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 694 "dcLexer.lxx" +{ + // A floating-point number. + accept(); + dcyylval.u.real = atof(dcyytext); + dcyylval.str = dcyytext; + return REAL; +} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 702 "dcLexer.lxx" +{ + // Quoted string. + accept(); + dcyylval.str = scan_quoted_string('"'); + return STRING; +} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 709 "dcLexer.lxx" +{ + // Single-quoted string. + accept(); + dcyylval.str = scan_quoted_string('\''); + return STRING; +} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 716 "dcLexer.lxx" +{ + // Long hex string. + accept(); + dcyylval.str = scan_hex_string(); + return HEX_STRING; +} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 723 "dcLexer.lxx" +{ + // Identifier or keyword. + accept(); + dcyylval.str = dcyytext; + + if (dc_file != (DCFile *)NULL) { + const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str); + if (keyword != (DCKeyword *)NULL) { + dcyylval.u.keyword = keyword; + return KEYWORD; + } + } + return IDENTIFIER; +} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 739 "dcLexer.lxx" +{ + // Send any other printable character as itself. + accept(); + return dcyytext[0]; +} + YY_BREAK +case 44: +YY_RULE_SETUP +#line 745 "dcLexer.lxx" +ECHO; + YY_BREAK +#line 1610 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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; + + 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); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = 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 >= 165 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + 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 char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = 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 >= 165 ) + 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 == 164); + + 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; + + + 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; + + + 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 _WIN32 +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#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 745 "dcLexer.lxx" diff --git a/direct/src/dcparser/dcParser.cxx.prebuilt b/direct/src/dcparser/dcParser.cxx.prebuilt index a8adcc2e96..e0be7b5ca9 100644 --- a/direct/src/dcparser/dcParser.cxx.prebuilt +++ b/direct/src/dcparser/dcParser.cxx.prebuilt @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.0. */ +/* A Bison parser, made by GNU Bison 1.875b. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 @@ -45,7 +45,8 @@ /* Using locations. */ #define YYLSP_NEEDED 0 -/* Substitute the variable and function names. */ +/* If NAME_PREFIX is specified substitute the variables and functions + names. */ #define yyparse dcyyparse #define yylex dcyylex #define yyerror dcyyerror @@ -252,26 +253,23 @@ typedef int YYSTYPE; /* Copy the second part of user declarations. */ -/* Line 213 of yacc.c. */ -#line 257 "y.tab.c" +/* Line 214 of yacc.c. */ +#line 258 "y.tab.c" #if ! defined (yyoverflow) || YYERROR_VERBOSE -# ifndef YYFREE -# define YYFREE free -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# endif - /* 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 -# else +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif # endif # endif # endif @@ -284,20 +282,20 @@ typedef int YYSTYPE; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + || (YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; + short yyss; YYSTYPE yyvs; }; @@ -307,13 +305,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short) + 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__ +# if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -349,22 +347,22 @@ union yyalloc #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short int yysigned_char; + typedef short yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 57 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 428 +#define YYLAST 430 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 58 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 81 +#define YYNNTS 82 /* YYNRULES -- Number of rules. */ -#define YYNRULES 188 +#define YYNRULES 190 /* YYNRULES -- Number of states. */ -#define YYNSTATES 280 +#define YYNSTATES 282 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -411,109 +409,111 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short int yyprhs[] = +static const unsigned short yyprhs[] = { 0, 0, 3, 6, 9, 12, 14, 17, 20, 23, 26, 29, 32, 34, 38, 40, 44, 47, 48, 54, - 56, 58, 60, 64, 67, 70, 73, 75, 77, 78, - 86, 88, 90, 93, 95, 99, 101, 104, 108, 111, - 114, 117, 120, 121, 129, 131, 133, 136, 138, 142, - 144, 147, 151, 154, 157, 160, 163, 164, 170, 172, - 174, 176, 180, 182, 183, 187, 189, 191, 192, 197, - 199, 200, 205, 207, 209, 211, 213, 215, 217, 220, - 223, 226, 228, 233, 237, 241, 243, 245, 247, 249, - 251, 253, 257, 260, 264, 270, 275, 277, 279, 283, - 286, 290, 296, 301, 303, 308, 310, 314, 318, 323, - 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, - 345, 347, 348, 353, 355, 357, 359, 361, 363, 364, - 369, 370, 375, 376, 381, 385, 389, 393, 397, 399, - 402, 404, 406, 408, 412, 414, 416, 418, 420, 422, - 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, - 444, 446, 448, 450, 452, 454, 457, 459, 460, 465, - 467, 469, 473, 475, 477, 478, 488, 490, 493, 496, - 499, 503, 507, 508, 513, 516, 518, 520, 522 + 56, 58, 60, 64, 67, 70, 72, 75, 78, 80, + 82, 83, 91, 93, 95, 98, 100, 104, 106, 109, + 113, 116, 119, 122, 125, 126, 134, 136, 138, 141, + 143, 147, 149, 152, 156, 159, 162, 165, 168, 169, + 175, 177, 179, 181, 185, 187, 188, 192, 194, 196, + 197, 202, 204, 205, 210, 212, 214, 216, 218, 220, + 222, 225, 228, 231, 233, 238, 242, 246, 248, 250, + 252, 254, 256, 258, 262, 265, 269, 275, 280, 282, + 284, 288, 291, 295, 301, 306, 308, 313, 315, 319, + 323, 328, 330, 332, 334, 336, 338, 340, 342, 344, + 346, 348, 350, 352, 353, 358, 360, 362, 364, 366, + 368, 369, 374, 375, 380, 381, 386, 390, 394, 398, + 402, 404, 407, 409, 411, 413, 417, 419, 421, 423, + 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, + 445, 447, 449, 451, 453, 455, 457, 459, 462, 464, + 465, 470, 472, 474, 478, 480, 482, 483, 493, 495, + 498, 501, 504, 508, 512, 513, 518, 521, 523, 525, + 527 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = +static const short yyrhs[] = { - 59, 0, -1, 40, 60, -1, 41, 113, -1, 42, - 99, -1, 138, -1, 60, 43, -1, 60, 69, -1, - 60, 130, -1, 60, 63, -1, 60, 67, -1, 60, + 59, 0, -1, 40, 60, -1, 41, 114, -1, 42, + 100, -1, 139, -1, 60, 43, -1, 60, 70, -1, + 60, 131, -1, 60, 63, -1, 60, 67, -1, 60, 68, -1, 8, -1, 61, 44, 8, -1, 61, -1, 62, 45, 61, -1, 13, 62, -1, -1, 12, 62, 13, 64, 65, -1, 66, -1, 46, -1, 61, -1, - 66, 47, 61, -1, 14, 97, -1, 15, 8, -1, - 15, 9, -1, 70, -1, 77, -1, -1, 10, 129, - 71, 73, 48, 75, 49, -1, 8, -1, 138, -1, - 50, 74, -1, 72, -1, 74, 47, 72, -1, 138, - -1, 75, 43, -1, 75, 76, 43, -1, 84, 123, - -1, 125, 124, -1, 94, 123, -1, 92, 123, -1, - -1, 11, 129, 78, 80, 48, 82, 49, -1, 8, - -1, 138, -1, 50, 81, -1, 79, -1, 81, 47, - 79, -1, 138, -1, 82, 43, -1, 82, 83, 43, - -1, 84, 124, -1, 125, 124, -1, 94, 124, -1, - 92, 124, -1, -1, 129, 51, 85, 86, 52, -1, - 138, -1, 87, -1, 88, -1, 87, 47, 88, -1, - 97, -1, -1, 104, 90, 105, -1, 104, -1, 89, - -1, -1, 89, 53, 93, 113, -1, 91, -1, -1, - 91, 53, 95, 113, -1, 89, -1, 91, -1, 92, - -1, 94, -1, 96, -1, 84, -1, 84, 124, -1, - 94, 124, -1, 92, 124, -1, 122, -1, 100, 51, - 102, 52, -1, 100, 44, 107, -1, 100, 54, 111, - -1, 100, -1, 8, -1, 77, -1, 130, -1, 138, - -1, 112, -1, 112, 55, 112, -1, 112, 111, -1, - 102, 47, 112, -1, 102, 47, 112, 55, 112, -1, - 102, 47, 112, 111, -1, 138, -1, 106, -1, 106, - 55, 106, -1, 106, 108, -1, 103, 47, 106, -1, - 103, 47, 106, 55, 106, -1, 103, 47, 106, 108, - -1, 101, -1, 104, 56, 103, 57, -1, 8, -1, - 105, 44, 107, -1, 105, 54, 111, -1, 105, 56, - 103, 57, -1, 6, -1, 107, -1, 3, -1, 4, - -1, 4, -1, 3, -1, 110, -1, 109, -1, 5, - -1, 6, -1, 111, -1, 115, -1, -1, 8, 53, - 114, 115, -1, 109, -1, 110, -1, 5, -1, 6, - -1, 7, -1, -1, 48, 116, 119, 49, -1, -1, - 56, 117, 119, 57, -1, -1, 51, 118, 119, 52, - -1, 109, 46, 107, -1, 110, 46, 107, -1, 5, - 46, 107, -1, 7, 46, 107, -1, 120, -1, 121, - 120, -1, 138, -1, 47, -1, 113, -1, 121, 47, - 113, -1, 20, -1, 21, -1, 22, -1, 23, -1, - 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, - 29, -1, 30, -1, 31, -1, 32, -1, 33, -1, - 34, -1, 35, -1, 36, -1, 37, -1, 38, -1, - 39, -1, 138, -1, 123, 9, -1, 123, -1, -1, - 8, 50, 126, 128, -1, 8, -1, 127, -1, 128, - 47, 127, -1, 138, -1, 8, -1, -1, 16, 129, - 51, 98, 52, 48, 131, 132, 49, -1, 138, -1, - 132, 43, -1, 132, 133, -1, 132, 135, -1, 132, - 136, 43, -1, 132, 137, 43, -1, -1, 17, 134, - 113, 50, -1, 18, 50, -1, 19, -1, 94, -1, - 92, -1, -1 + 66, 47, 61, -1, 14, 98, -1, 15, 69, -1, + 139, -1, 69, 8, -1, 69, 9, -1, 71, -1, + 78, -1, -1, 10, 130, 72, 74, 48, 76, 49, + -1, 8, -1, 139, -1, 50, 75, -1, 73, -1, + 75, 47, 73, -1, 139, -1, 76, 43, -1, 76, + 77, 43, -1, 85, 124, -1, 126, 125, -1, 95, + 124, -1, 93, 124, -1, -1, 11, 130, 79, 81, + 48, 83, 49, -1, 8, -1, 139, -1, 50, 82, + -1, 80, -1, 82, 47, 80, -1, 139, -1, 83, + 43, -1, 83, 84, 43, -1, 85, 125, -1, 126, + 125, -1, 95, 125, -1, 93, 125, -1, -1, 130, + 51, 86, 87, 52, -1, 139, -1, 88, -1, 89, + -1, 88, 47, 89, -1, 98, -1, -1, 105, 91, + 106, -1, 105, -1, 90, -1, -1, 90, 53, 94, + 114, -1, 92, -1, -1, 92, 53, 96, 114, -1, + 90, -1, 92, -1, 93, -1, 95, -1, 97, -1, + 85, -1, 85, 125, -1, 95, 125, -1, 93, 125, + -1, 123, -1, 101, 51, 103, 52, -1, 101, 44, + 108, -1, 101, 54, 112, -1, 101, -1, 8, -1, + 78, -1, 131, -1, 139, -1, 113, -1, 113, 55, + 113, -1, 113, 112, -1, 103, 47, 113, -1, 103, + 47, 113, 55, 113, -1, 103, 47, 113, 112, -1, + 139, -1, 107, -1, 107, 55, 107, -1, 107, 109, + -1, 104, 47, 107, -1, 104, 47, 107, 55, 107, + -1, 104, 47, 107, 109, -1, 102, -1, 105, 56, + 104, 57, -1, 8, -1, 106, 44, 108, -1, 106, + 54, 112, -1, 106, 56, 104, 57, -1, 6, -1, + 108, -1, 3, -1, 4, -1, 4, -1, 3, -1, + 111, -1, 110, -1, 5, -1, 6, -1, 112, -1, + 116, -1, -1, 8, 53, 115, 116, -1, 110, -1, + 111, -1, 5, -1, 6, -1, 7, -1, -1, 48, + 117, 120, 49, -1, -1, 56, 118, 120, 57, -1, + -1, 51, 119, 120, 52, -1, 110, 46, 108, -1, + 111, 46, 108, -1, 5, 46, 108, -1, 7, 46, + 108, -1, 121, -1, 122, 121, -1, 139, -1, 47, + -1, 114, -1, 122, 47, 114, -1, 20, -1, 21, + -1, 22, -1, 23, -1, 24, -1, 25, -1, 26, + -1, 27, -1, 28, -1, 29, -1, 30, -1, 31, + -1, 32, -1, 33, -1, 34, -1, 35, -1, 36, + -1, 37, -1, 38, -1, 39, -1, 139, -1, 124, + 9, -1, 124, -1, -1, 8, 50, 127, 129, -1, + 8, -1, 128, -1, 129, 47, 128, -1, 139, -1, + 8, -1, -1, 16, 130, 51, 99, 52, 48, 132, + 133, 49, -1, 139, -1, 133, 43, -1, 133, 134, + -1, 133, 136, -1, 133, 137, 43, -1, 133, 138, + 43, -1, -1, 17, 135, 114, 50, -1, 18, 50, + -1, 19, -1, 95, -1, 93, -1, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const unsigned short yyrline[] = { 0, 168, 168, 169, 170, 177, 178, 179, 190, 196, 197, 198, 202, 203, 210, 211, 218, 223, 222, 230, - 231, 238, 242, 249, 267, 271, 282, 283, 288, 287, - 300, 323, 324, 328, 334, 348, 349, 350, 363, 373, - 374, 382, 393, 392, 405, 428, 429, 433, 439, 448, - 449, 450, 461, 468, 469, 473, 481, 480, 499, 500, - 504, 505, 509, 519, 518, 529, 533, 535, 534, 563, - 565, 564, 593, 594, 598, 599, 603, 607, 614, 618, - 622, 629, 633, 642, 658, 673, 674, 706, 722, 741, - 745, 752, 759, 768, 774, 780, 791, 795, 802, 809, - 816, 822, 828, 837, 838, 849, 854, 869, 884, 891, - 900, 904, 915, 929, 933, 937, 941, 945, 949, 958, - 963, 968, 967, 983, 987, 991, 995, 999, 1004, 1003, - 1012, 1011, 1020, 1019, 1027, 1033, 1039, 1045, 1054, 1055, - 1059, 1060, 1064, 1065, 1069, 1073, 1077, 1081, 1085, 1089, - 1093, 1097, 1101, 1105, 1109, 1113, 1117, 1121, 1125, 1129, - 1133, 1137, 1141, 1145, 1152, 1156, 1163, 1173, 1172, 1183, - 1199, 1205, 1219, 1223, 1228, 1227, 1241, 1242, 1243, 1244, - 1245, 1246, 1260, 1259, 1280, 1289, 1296, 1300, 1306 + 231, 238, 242, 249, 267, 271, 272, 276, 287, 288, + 293, 292, 305, 328, 329, 333, 339, 353, 354, 355, + 368, 378, 379, 387, 398, 397, 410, 433, 434, 438, + 444, 453, 454, 455, 466, 473, 474, 478, 486, 485, + 504, 505, 509, 510, 514, 524, 523, 534, 538, 540, + 539, 568, 570, 569, 598, 599, 603, 604, 608, 612, + 619, 623, 627, 634, 638, 647, 663, 678, 679, 711, + 727, 746, 750, 757, 764, 773, 779, 785, 796, 800, + 807, 814, 821, 827, 833, 842, 843, 854, 859, 874, + 889, 896, 905, 909, 920, 934, 938, 942, 946, 950, + 954, 963, 968, 973, 972, 988, 992, 996, 1000, 1004, + 1009, 1008, 1017, 1016, 1025, 1024, 1032, 1038, 1044, 1050, + 1059, 1060, 1064, 1065, 1069, 1070, 1074, 1078, 1082, 1086, + 1090, 1094, 1098, 1102, 1106, 1110, 1114, 1118, 1122, 1126, + 1130, 1134, 1138, 1142, 1146, 1150, 1157, 1161, 1168, 1178, + 1177, 1188, 1204, 1210, 1224, 1228, 1233, 1232, 1246, 1247, + 1248, 1249, 1250, 1251, 1265, 1264, 1285, 1294, 1301, 1305, + 1311 }; #endif @@ -522,43 +522,44 @@ static const unsigned short int yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "UNSIGNED_INTEGER", "SIGNED_INTEGER", - "REAL", "STRING", "HEX_STRING", "IDENTIFIER", "KEYWORD", "KW_DCLASS", - "KW_STRUCT", "KW_FROM", "KW_IMPORT", "KW_TYPEDEF", "KW_KEYWORD", - "KW_SWITCH", "KW_CASE", "KW_DEFAULT", "KW_BREAK", "KW_INT8", "KW_INT16", - "KW_INT32", "KW_INT64", "KW_UINT8", "KW_UINT16", "KW_UINT32", - "KW_UINT64", "KW_FLOAT64", "KW_STRING", "KW_BLOB", "KW_BLOB32", - "KW_INT8ARRAY", "KW_INT16ARRAY", "KW_INT32ARRAY", "KW_UINT8ARRAY", - "KW_UINT16ARRAY", "KW_UINT32ARRAY", "KW_UINT32UINT8ARRAY", "KW_CHAR", - "START_DC", "START_PARAMETER_VALUE", "START_PARAMETER_DESCRIPTION", - "';'", "'/'", "'.'", "'*'", "','", "'{'", "'}'", "':'", "'('", "')'", - "'='", "'%'", "'-'", "'['", "']'", "$accept", "grammar", "dc", - "slash_identifier", "import_identifier", "import", "@1", - "import_symbol_list_or_star", "import_symbol_list", "typedef_decl", - "keyword_decl", "dclass_or_struct", "dclass", "@2", "dclass_name", - "dclass_derivation", "dclass_base_list", "dclass_fields", "dclass_field", - "struct", "@3", "struct_name", "struct_derivation", "struct_base_list", - "struct_fields", "struct_field", "atomic_field", "@4", "parameter_list", - "nonempty_parameter_list", "atomic_element", "named_parameter", "@5", - "unnamed_parameter", "named_parameter_with_default", "@6", - "unnamed_parameter_with_default", "@7", "parameter", - "parameter_with_default", "parameter_or_atomic", "parameter_description", - "simple_type_name", "type_name", "double_range", "uint_range", - "type_definition", "parameter_definition", "char_or_uint", - "small_unsigned_integer", "small_negative_integer", "signed_integer", - "unsigned_integer", "number", "char_or_number", "parameter_value", "@8", - "parameter_actual_value", "@9", "@10", "@11", "array", "maybe_comma", - "array_def", "type_token", "keyword_list", "no_keyword_list", - "molecular_field", "@12", "atomic_name", "molecular_atom_list", - "optional_name", "switch", "@13", "switch_fields", "switch_case", "@14", - "switch_default", "switch_break", "switch_field", "empty", 0 + "$end", "error", "$undefined", "UNSIGNED_INTEGER", "SIGNED_INTEGER", + "REAL", "STRING", "HEX_STRING", "IDENTIFIER", "KEYWORD", "KW_DCLASS", + "KW_STRUCT", "KW_FROM", "KW_IMPORT", "KW_TYPEDEF", "KW_KEYWORD", + "KW_SWITCH", "KW_CASE", "KW_DEFAULT", "KW_BREAK", "KW_INT8", "KW_INT16", + "KW_INT32", "KW_INT64", "KW_UINT8", "KW_UINT16", "KW_UINT32", + "KW_UINT64", "KW_FLOAT64", "KW_STRING", "KW_BLOB", "KW_BLOB32", + "KW_INT8ARRAY", "KW_INT16ARRAY", "KW_INT32ARRAY", "KW_UINT8ARRAY", + "KW_UINT16ARRAY", "KW_UINT32ARRAY", "KW_UINT32UINT8ARRAY", "KW_CHAR", + "START_DC", "START_PARAMETER_VALUE", "START_PARAMETER_DESCRIPTION", + "';'", "'/'", "'.'", "'*'", "','", "'{'", "'}'", "':'", "'('", "')'", + "'='", "'%'", "'-'", "'['", "']'", "$accept", "grammar", "dc", + "slash_identifier", "import_identifier", "import", "@1", + "import_symbol_list_or_star", "import_symbol_list", "typedef_decl", + "keyword_decl", "keyword_decl_list", "dclass_or_struct", "dclass", "@2", + "dclass_name", "dclass_derivation", "dclass_base_list", "dclass_fields", + "dclass_field", "struct", "@3", "struct_name", "struct_derivation", + "struct_base_list", "struct_fields", "struct_field", "atomic_field", + "@4", "parameter_list", "nonempty_parameter_list", "atomic_element", + "named_parameter", "@5", "unnamed_parameter", + "named_parameter_with_default", "@6", "unnamed_parameter_with_default", + "@7", "parameter", "parameter_with_default", "parameter_or_atomic", + "parameter_description", "simple_type_name", "type_name", + "double_range", "uint_range", "type_definition", "parameter_definition", + "char_or_uint", "small_unsigned_integer", "small_negative_integer", + "signed_integer", "unsigned_integer", "number", "char_or_number", + "parameter_value", "@8", "parameter_actual_value", "@9", "@10", "@11", + "array", "maybe_comma", "array_def", "type_token", "keyword_list", + "no_keyword_list", "molecular_field", "@12", "atomic_name", + "molecular_atom_list", "optional_name", "switch", "@13", + "switch_fields", "switch_case", "@14", "switch_default", "switch_break", + "switch_field", "empty", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const unsigned short yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -574,23 +575,24 @@ static const unsigned char yyr1[] = { 0, 58, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 61, 61, 62, 62, 63, 64, 63, 65, - 65, 66, 66, 67, 68, 68, 69, 69, 71, 70, - 72, 73, 73, 74, 74, 75, 75, 75, 76, 76, - 76, 76, 78, 77, 79, 80, 80, 81, 81, 82, - 82, 82, 83, 83, 83, 83, 85, 84, 86, 86, - 87, 87, 88, 90, 89, 91, 92, 93, 92, 94, - 95, 94, 96, 96, 97, 97, 98, 98, 99, 99, - 99, 100, 100, 100, 100, 101, 101, 101, 101, 102, - 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, - 103, 103, 103, 104, 104, 105, 105, 105, 105, 106, - 106, 107, 108, 109, 110, 111, 111, 111, 112, 112, - 113, 114, 113, 115, 115, 115, 115, 115, 116, 115, - 117, 115, 118, 115, 115, 115, 115, 115, 119, 119, - 120, 120, 121, 121, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 123, 123, 124, 126, 125, 127, - 128, 128, 129, 129, 131, 130, 132, 132, 132, 132, - 132, 132, 134, 133, 135, 136, 137, 137, 138 + 65, 66, 66, 67, 68, 69, 69, 69, 70, 70, + 72, 71, 73, 74, 74, 75, 75, 76, 76, 76, + 77, 77, 77, 77, 79, 78, 80, 81, 81, 82, + 82, 83, 83, 83, 84, 84, 84, 84, 86, 85, + 87, 87, 88, 88, 89, 91, 90, 92, 93, 94, + 93, 95, 96, 95, 97, 97, 98, 98, 99, 99, + 100, 100, 100, 101, 101, 101, 101, 102, 102, 102, + 102, 103, 103, 103, 103, 103, 103, 103, 104, 104, + 104, 104, 104, 104, 104, 105, 105, 106, 106, 106, + 106, 107, 107, 108, 109, 110, 111, 112, 112, 112, + 113, 113, 114, 115, 114, 116, 116, 116, 116, 116, + 117, 116, 118, 116, 119, 116, 116, 116, 116, 116, + 120, 120, 121, 121, 122, 122, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 124, 124, 125, 127, + 126, 128, 129, 129, 130, 130, 132, 131, 133, 133, + 133, 133, 133, 133, 135, 134, 136, 137, 138, 138, + 139 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -598,23 +600,24 @@ static const unsigned char yyr2[] = { 0, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 3, 1, 3, 2, 0, 5, 1, - 1, 1, 3, 2, 2, 2, 1, 1, 0, 7, - 1, 1, 2, 1, 3, 1, 2, 3, 2, 2, - 2, 2, 0, 7, 1, 1, 2, 1, 3, 1, - 2, 3, 2, 2, 2, 2, 0, 5, 1, 1, - 1, 3, 1, 0, 3, 1, 1, 0, 4, 1, - 0, 4, 1, 1, 1, 1, 1, 1, 2, 2, - 2, 1, 4, 3, 3, 1, 1, 1, 1, 1, - 1, 3, 2, 3, 5, 4, 1, 1, 3, 2, - 3, 5, 4, 1, 4, 1, 3, 3, 4, 1, + 1, 1, 3, 2, 2, 1, 2, 2, 1, 1, + 0, 7, 1, 1, 2, 1, 3, 1, 2, 3, + 2, 2, 2, 2, 0, 7, 1, 1, 2, 1, + 3, 1, 2, 3, 2, 2, 2, 2, 0, 5, + 1, 1, 1, 3, 1, 0, 3, 1, 1, 0, + 4, 1, 0, 4, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 1, 4, 3, 3, 1, 1, 1, + 1, 1, 1, 3, 2, 3, 5, 4, 1, 1, + 3, 2, 3, 5, 4, 1, 4, 1, 3, 3, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 4, 1, 1, 1, 1, 1, + 0, 4, 0, 4, 0, 4, 3, 3, 3, 3, + 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 4, 1, 1, 1, 1, 1, 0, 4, - 0, 4, 0, 4, 3, 3, 3, 3, 1, 2, - 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 1, 0, 4, 1, - 1, 3, 1, 1, 0, 9, 1, 2, 2, 2, - 3, 3, 0, 4, 2, 1, 1, 1, 0 + 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, + 4, 1, 1, 3, 1, 1, 0, 9, 1, 2, + 2, 2, 3, 3, 0, 4, 2, 1, 1, 1, + 0 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -622,230 +625,235 @@ static const unsigned char yyr2[] = means the default is an error. */ static const unsigned char yydefact[] = { - 0, 188, 0, 188, 0, 2, 5, 114, 113, 125, - 126, 127, 0, 128, 132, 130, 123, 124, 3, 120, - 86, 188, 188, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 87, 188, 66, 69, 188, 188, 4, - 85, 103, 65, 81, 0, 88, 172, 1, 188, 0, - 0, 0, 0, 6, 9, 10, 11, 7, 26, 27, - 8, 0, 0, 121, 188, 188, 188, 0, 0, 173, - 42, 0, 166, 78, 164, 67, 70, 80, 79, 0, - 188, 0, 188, 0, 56, 28, 12, 14, 0, 16, - 86, 74, 75, 23, 24, 25, 111, 136, 137, 0, - 141, 142, 0, 138, 188, 140, 0, 0, 134, 135, - 188, 188, 165, 0, 0, 83, 117, 118, 0, 116, - 115, 119, 90, 89, 84, 109, 0, 97, 110, 96, - 105, 64, 188, 188, 0, 17, 0, 122, 129, 141, - 139, 133, 131, 0, 0, 45, 77, 72, 73, 76, - 0, 68, 71, 0, 82, 0, 92, 0, 104, 112, - 0, 99, 0, 0, 188, 0, 59, 60, 62, 58, - 0, 0, 31, 13, 0, 15, 143, 44, 47, 46, - 188, 0, 93, 91, 100, 98, 106, 107, 0, 57, - 0, 30, 33, 32, 188, 20, 21, 18, 19, 0, - 188, 49, 174, 0, 95, 0, 102, 108, 61, 0, - 188, 35, 0, 48, 86, 50, 43, 0, 188, 188, - 188, 188, 188, 94, 101, 34, 36, 29, 0, 188, - 188, 188, 188, 22, 167, 51, 52, 55, 54, 53, - 0, 176, 37, 38, 41, 40, 39, 0, 182, 0, - 185, 177, 175, 187, 186, 178, 179, 0, 0, 169, - 170, 168, 0, 184, 180, 181, 0, 0, 171, 183 + 0, 190, 0, 190, 0, 2, 5, 116, 115, 127, + 128, 129, 0, 130, 134, 132, 125, 126, 3, 122, + 88, 190, 190, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 89, 190, 68, 71, 190, 190, 4, + 87, 105, 67, 83, 0, 90, 174, 1, 190, 0, + 0, 0, 190, 6, 9, 10, 11, 7, 28, 29, + 8, 0, 0, 123, 190, 190, 190, 0, 0, 175, + 44, 0, 168, 80, 166, 69, 72, 82, 81, 0, + 190, 0, 190, 0, 58, 30, 12, 14, 0, 16, + 88, 76, 77, 23, 24, 25, 113, 138, 139, 0, + 143, 144, 0, 140, 190, 142, 0, 0, 136, 137, + 190, 190, 167, 0, 0, 85, 119, 120, 0, 118, + 117, 121, 92, 91, 86, 111, 0, 99, 112, 98, + 107, 66, 190, 190, 0, 17, 0, 26, 27, 124, + 131, 143, 141, 135, 133, 0, 0, 47, 79, 74, + 75, 78, 0, 70, 73, 0, 84, 0, 94, 0, + 106, 114, 0, 101, 0, 0, 190, 0, 61, 62, + 64, 60, 0, 0, 33, 13, 0, 15, 145, 46, + 49, 48, 190, 0, 95, 93, 102, 100, 108, 109, + 0, 59, 0, 32, 35, 34, 190, 20, 21, 18, + 19, 0, 190, 51, 176, 0, 97, 0, 104, 110, + 63, 0, 190, 37, 0, 50, 88, 52, 45, 0, + 190, 190, 190, 190, 190, 96, 103, 36, 38, 31, + 0, 190, 190, 190, 190, 22, 169, 53, 54, 57, + 56, 55, 0, 178, 39, 40, 43, 42, 41, 0, + 184, 0, 187, 179, 177, 189, 188, 180, 181, 0, + 0, 171, 172, 170, 0, 186, 182, 183, 0, 0, + 173, 185 }; /* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = +static const short yydefgoto[] = { - -1, 4, 5, 97, 98, 64, 184, 207, 208, 65, - 66, 67, 68, 143, 202, 181, 203, 220, 238, 43, - 120, 188, 154, 189, 210, 227, 44, 142, 175, 176, - 177, 45, 93, 46, 101, 123, 102, 124, 159, 178, - 160, 49, 50, 51, 128, 136, 52, 141, 137, 138, - 171, 16, 17, 131, 132, 111, 109, 19, 74, 76, - 75, 112, 113, 114, 53, 82, 83, 231, 257, 270, - 271, 54, 55, 232, 250, 265, 272, 266, 267, 268, - 84 + -1, 4, 5, 97, 98, 64, 186, 209, 210, 65, + 66, 104, 67, 68, 143, 204, 183, 205, 222, 240, + 43, 120, 190, 156, 191, 212, 229, 44, 142, 177, + 178, 179, 45, 93, 46, 101, 123, 102, 124, 161, + 180, 162, 49, 50, 51, 128, 136, 52, 141, 137, + 138, 173, 16, 17, 131, 132, 111, 109, 19, 74, + 76, 75, 112, 113, 114, 53, 82, 83, 233, 259, + 272, 273, 54, 55, 234, 252, 267, 274, 268, 269, + 270, 84 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -141 -static const short int yypact[] = +#define YYPACT_NINF -127 +static const short yypact[] = { - 93, -141, 122, 357, 32, 138, -141, -141, -141, -7, - -141, 12, 7, -141, -141, -141, 34, 54, -141, -141, - -6, 79, 79, -141, -141, -141, -141, -141, -141, -141, - -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, - -141, -141, -141, -141, -141, 48, 50, -141, -141, -141, - -13, -141, 8, -141, 63, -141, -141, -141, 79, 108, - 108, 389, 81, -141, -141, -141, -141, -141, -141, -141, - -141, 116, 116, -141, 62, 62, 62, 116, 116, -141, - -141, 69, 128, -141, -141, -141, -141, -141, -141, 116, - 102, 152, 53, 123, -141, -141, -141, 94, 27, 99, - -141, -141, -141, -141, -141, -141, -141, -141, -141, 136, - -141, -141, 109, -141, 115, -141, 111, 107, -141, -141, - 117, 357, -141, 122, 122, -141, -141, -141, 5, -141, - -141, -141, 16, -141, -141, -141, -10, 18, -141, -141, - -141, -8, 389, 118, 157, -141, 108, -141, -141, 122, - -141, -141, -141, 158, 121, -141, -141, -141, -141, -141, - 119, -141, -141, 102, -141, 102, -141, 53, -141, -141, - 53, -141, 116, 152, 53, 120, 127, -141, -141, -141, - 167, 131, -141, -141, 35, 94, -141, -141, -141, 129, - -141, 132, 30, -141, 19, -141, -141, -141, -3, -141, - 389, -141, -141, 135, -141, -141, 94, -141, 139, 158, - 289, -141, -141, 102, -141, 53, -141, -141, -141, 167, - 323, -141, 108, -141, 47, -141, -141, 140, -141, -141, - -141, -141, -141, -141, -141, -141, -141, -141, 142, -141, - -141, -141, -141, 94, -141, -141, -141, -141, -141, -141, - 255, -141, -141, 128, 128, 128, -141, 186, -141, 145, - -141, -141, -141, -141, -141, -141, -141, 153, 154, -141, - -141, 151, 122, -141, -141, -141, 186, 149, -141, -141 + 8, -127, 104, 359, 35, 128, -127, -127, -127, 20, + -127, 22, 28, -127, -127, -127, 37, 53, -127, -127, + 54, 139, 139, -127, -127, -127, -127, -127, -127, -127, + -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, + -127, -127, -127, -127, -127, 95, 97, -127, -127, -127, + 2, -127, 26, -127, 100, -127, -127, -127, 139, 145, + 145, 391, -127, -127, -127, -127, -127, -127, -127, -127, + -127, 151, 151, -127, 24, 24, 24, 151, 151, -127, + -127, 108, 152, -127, -127, -127, -127, -127, -127, 151, + 127, 98, 64, 154, -127, -127, -127, 119, 13, 120, + -127, -127, -127, -127, 106, -127, -127, -127, -127, 122, + -127, -127, 115, -127, 121, -127, 114, 110, -127, -127, + 124, 359, -127, 104, 104, -127, -127, -127, 12, -127, + -127, -127, 14, -127, -127, -127, 16, 7, -127, -127, + -127, 1, 391, 125, 161, -127, 145, -127, -127, -127, + -127, 104, -127, -127, -127, 164, 129, -127, -127, -127, + -127, -127, 130, -127, -127, 127, -127, 127, -127, 64, + -127, -127, 64, -127, 151, 98, 64, 131, 133, -127, + -127, -127, 168, 136, -127, -127, 6, 119, -127, -127, + -127, 134, -127, 137, 33, -127, 19, -127, -127, -127, + 43, -127, 391, -127, -127, 140, -127, -127, 119, -127, + 141, 164, 291, -127, -127, 127, -127, 64, -127, -127, + -127, 168, 325, -127, 145, -127, 69, -127, -127, 143, + -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, + 146, -127, -127, -127, -127, 119, -127, -127, -127, -127, + -127, -127, 257, -127, -127, 152, 152, 152, -127, 186, + -127, 147, -127, -127, -127, -127, -127, -127, -127, 153, + 155, -127, -127, 156, 104, -127, -127, -127, 186, 149, + -127, -127 }; /* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = +static const short yypgoto[] = { - -141, -141, -141, -131, 141, -141, -141, -141, -141, -141, - -141, -141, -141, -141, -19, -141, -141, -141, -141, 198, - -141, -5, -141, -141, -141, -141, -116, -141, -141, -141, - 6, 84, -141, 87, -1, -141, 0, -141, -141, 150, - -141, -141, -141, -141, -141, 38, -141, -141, -140, -60, - 20, -81, -77, -90, -137, -2, -141, 106, -141, -141, - -141, -26, 103, -141, -141, -80, -40, -4, -141, -58, - -141, 41, 216, -141, -141, -141, -141, -141, -141, -141, - 3 + -127, -127, -127, -126, 142, -127, -127, -127, -127, -127, + -127, -127, -127, -127, -127, -21, -127, -127, -127, -127, + 196, -127, -6, -127, -127, -127, -127, -116, -127, -127, + -127, 4, 86, -127, 87, -1, -127, 0, -127, -127, + 157, -127, -127, -127, -127, -127, 34, -127, -127, -125, + -56, 17, -81, -78, -90, -124, -2, -127, 105, -127, + -127, -127, 60, 102, -127, -127, -85, -40, -5, -127, + -59, -127, 18, 215, -127, -127, -127, -127, -127, -127, + -127, 3 }; /* 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 -174 -static const short int yytable[] = +#define YYTABLE_NINF -176 +static const short yytable[] = { - 18, 134, 47, 48, 6, 156, 56, 87, 88, 129, - 129, 107, 108, 130, 130, 185, -63, 118, 119, 7, - 8, 126, 169, 169, 56, 56, 192, 194, 193, 125, - 195, 89, 57, 7, 8, 126, 172, 167, 90, 71, - 145, 91, 166, 96, 167, -173, 173, 168, 174, 116, - 117, 129, 163, 206, 217, 130, 106, 164, 72, 135, - 73, 56, 80, 81, 92, 7, 8, 9, 10, 11, - 12, 165, 146, 170, 215, 234, 233, 115, 115, 115, - 77, 205, 129, 197, 129, 213, 130, 79, 130, 104, - 105, 243, 129, 133, 228, 139, 130, 244, -173, 95, - 78, 85, 214, 86, 239, 7, 8, 126, 127, 110, - 13, 129, 196, 14, 94, 130, 96, 115, 15, 106, - 121, 161, 162, 155, 56, 7, 8, 9, 10, 11, - 12, 140, 129, 1, 2, 3, 130, 122, 144, 7, - 8, 9, 10, 11, 146, 179, 182, 186, 58, 21, - 59, 60, 61, 62, 22, 7, 8, 126, 148, 253, - 254, 255, 149, 151, 152, 183, 187, 153, 180, 190, - 13, 191, 199, 14, 200, 201, 209, 139, 15, 204, - 212, 63, 219, 245, 13, 252, 222, 14, 246, 247, - 248, 249, 15, 211, 269, 273, 274, 275, 276, 279, - 235, 99, 256, 69, 223, 157, 218, 221, 158, 229, - 230, 103, 198, 56, 216, 147, 242, 150, 278, 240, - 241, 70, 0, 56, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 251, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 263, - 264, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 100, 0, 0, 21, 0, 0, 0, - 277, 22, 258, 259, 260, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 0, 0, 224, 261, 0, - 21, 0, 0, 0, 262, 22, 0, 0, 0, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, - 0, 224, 225, 0, 21, 0, 0, 0, 226, 22, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 0, 0, 20, 236, 0, 21, 0, - 0, 0, 237, 22, 0, 0, 0, 23, 24, 25, + 18, 134, 47, 48, 6, 158, 56, 87, 88, 129, + 129, 171, 130, 130, 96, 107, 108, 7, 8, 126, + 187, 118, 119, 171, 56, 56, 145, 7, 8, 9, + 10, 11, 12, 125, -65, 57, 7, 8, 126, 80, + 81, 194, 168, 195, 196, 174, 89, 197, 1, 2, + 3, 129, 207, 90, 130, 175, 91, 176, 146, 165, + 208, 56, 172, 169, 166, 105, 71, 106, 72, 167, + 135, 110, 13, 170, 217, 14, 95, 115, 115, 115, + 15, 73, 92, 77, 129, 199, 129, 130, 215, 130, + 169, 235, 236, 133, 129, 139, 230, 130, 245, 78, + 219, 7, 8, 126, 216, -175, 241, 7, 8, 9, + 10, 11, 12, 129, 147, 148, 130, 115, 198, 246, + -175, 163, 164, 157, 56, 7, 8, 9, 10, 11, + 7, 8, 126, 127, 129, 116, 117, 130, 58, 21, + 59, 60, 61, 62, 22, 181, 184, 79, 85, 188, + 86, 94, 13, 96, 106, 14, 255, 256, 257, 121, + 15, 122, 140, 144, 150, 146, 153, 154, 151, 185, + 13, 63, 189, 14, 155, 182, 203, 192, 15, 139, + 202, 211, 193, 201, 206, 214, 247, 221, 224, 254, + 248, 249, 250, 251, 271, 213, 276, 275, 277, 281, + 237, 69, 99, 278, 258, 225, 220, 159, 160, 223, + 200, 231, 232, 218, 149, 56, 152, 244, 103, 280, + 70, 242, 243, 0, 0, 56, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 253, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 265, 266, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 100, 0, 0, 21, 0, + 0, 0, 279, 22, 260, 261, 262, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 100, 0, 0, - 21, 0, 0, 0, 0, 22, 0, 0, 0, 23, + 36, 37, 38, 39, 40, 41, 42, 0, 0, 226, + 263, 0, 21, 0, 0, 0, 264, 22, 0, 0, + 0, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 0, 0, 226, 227, 0, 21, 0, 0, 0, + 228, 22, 0, 0, 0, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 0, 0, 20, 238, 0, + 21, 0, 0, 0, 239, 22, 0, 0, 0, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42 + 34, 35, 36, 37, 38, 39, 40, 41, 42, 100, + 0, 0, 21, 0, 0, 0, 0, 22, 0, 0, + 0, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42 }; -static const short int yycheck[] = +static const short yycheck[] = { 2, 91, 3, 3, 1, 121, 3, 47, 48, 90, - 91, 71, 72, 90, 91, 146, 8, 77, 78, 3, - 4, 5, 4, 4, 21, 22, 163, 167, 165, 89, - 170, 44, 0, 3, 4, 5, 44, 47, 51, 46, - 13, 54, 132, 8, 47, 51, 54, 57, 56, 75, - 76, 132, 47, 184, 57, 132, 3, 52, 46, 6, - 53, 58, 21, 22, 56, 3, 4, 5, 6, 7, - 8, 55, 45, 55, 55, 215, 213, 74, 75, 76, - 46, 46, 163, 173, 165, 55, 163, 8, 165, 8, - 9, 222, 173, 90, 210, 92, 173, 50, 51, 58, - 46, 53, 192, 53, 220, 3, 4, 5, 6, 47, - 48, 192, 172, 51, 51, 192, 8, 114, 56, 3, + 91, 4, 90, 91, 8, 71, 72, 3, 4, 5, + 146, 77, 78, 4, 21, 22, 13, 3, 4, 5, + 6, 7, 8, 89, 8, 0, 3, 4, 5, 21, + 22, 165, 132, 167, 169, 44, 44, 172, 40, 41, + 42, 132, 46, 51, 132, 54, 54, 56, 45, 47, + 186, 58, 55, 47, 52, 62, 46, 3, 46, 55, + 6, 47, 48, 57, 55, 51, 58, 74, 75, 76, + 56, 53, 56, 46, 165, 175, 167, 165, 55, 167, + 47, 215, 217, 90, 175, 92, 212, 175, 224, 46, + 57, 3, 4, 5, 194, 51, 222, 3, 4, 5, + 6, 7, 8, 194, 8, 9, 194, 114, 174, 50, 51, 123, 124, 120, 121, 3, 4, 5, 6, 7, - 8, 8, 213, 40, 41, 42, 213, 9, 44, 3, - 4, 5, 6, 7, 45, 142, 143, 149, 10, 11, - 12, 13, 14, 15, 16, 3, 4, 5, 49, 239, - 240, 241, 47, 52, 57, 8, 8, 50, 50, 48, - 48, 52, 52, 51, 47, 8, 47, 174, 56, 48, - 48, 43, 47, 43, 48, 43, 47, 51, 228, 229, - 230, 231, 56, 190, 8, 50, 43, 43, 47, 50, - 219, 60, 242, 5, 209, 121, 200, 204, 121, 210, - 210, 61, 174, 210, 194, 109, 220, 114, 276, 220, - 220, 5, -1, 220, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 232, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, - 250, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, - 272, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 3, 4, 5, 6, 215, 75, 76, 215, 10, 11, + 12, 13, 14, 15, 16, 142, 143, 8, 53, 151, + 53, 51, 48, 8, 3, 51, 241, 242, 243, 51, + 56, 9, 8, 44, 49, 45, 52, 57, 47, 8, + 48, 43, 8, 51, 50, 50, 8, 48, 56, 176, + 47, 47, 52, 52, 48, 48, 43, 47, 47, 43, + 230, 231, 232, 233, 8, 192, 43, 50, 43, 50, + 221, 5, 60, 47, 244, 211, 202, 121, 121, 206, + 176, 212, 212, 196, 109, 212, 114, 222, 61, 278, + 5, 222, 222, -1, -1, 222, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 252, 252, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 8, -1, -1, 11, -1, + -1, -1, 274, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, -1, -1, 8, + 43, -1, 11, -1, -1, -1, 49, 16, -1, -1, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, -1, -1, 8, 43, -1, 11, -1, -1, -1, + 49, 16, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 8, 43, -1, 11, -1, -1, -1, 49, 16, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, - -1, 8, 43, -1, 11, -1, -1, -1, 49, 16, - -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, -1, -1, 8, 43, -1, 11, -1, - -1, -1, 49, 16, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 8, -1, -1, - 11, -1, -1, -1, -1, 16, -1, -1, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39 + 31, 32, 33, 34, 35, 36, 37, 38, 39, 8, + -1, -1, 11, -1, -1, -1, -1, 16, -1, -1, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 40, 41, 42, 59, 60, 138, 3, 4, 5, - 6, 7, 8, 48, 51, 56, 109, 110, 113, 115, + 0, 40, 41, 42, 59, 60, 139, 3, 4, 5, + 6, 7, 8, 48, 51, 56, 110, 111, 114, 116, 8, 11, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 77, 84, 89, 91, 92, 94, 99, - 100, 101, 104, 122, 129, 130, 138, 0, 10, 12, - 13, 14, 15, 43, 63, 67, 68, 69, 70, 77, - 130, 46, 46, 53, 116, 118, 117, 46, 46, 8, - 129, 129, 123, 124, 138, 53, 53, 124, 124, 44, - 51, 54, 56, 90, 51, 129, 8, 61, 62, 62, - 8, 92, 94, 97, 8, 9, 3, 107, 107, 114, - 47, 113, 119, 120, 121, 138, 119, 119, 107, 107, - 78, 51, 9, 93, 95, 107, 5, 6, 102, 109, - 110, 111, 112, 138, 111, 6, 103, 106, 107, 138, - 8, 105, 85, 71, 44, 13, 45, 115, 49, 47, - 120, 52, 57, 50, 80, 138, 84, 89, 91, 96, - 98, 113, 113, 47, 52, 55, 111, 47, 57, 4, - 55, 108, 44, 54, 56, 86, 87, 88, 97, 138, - 50, 73, 138, 8, 64, 61, 113, 8, 79, 81, - 48, 52, 112, 112, 106, 106, 107, 111, 103, 52, - 47, 8, 72, 74, 48, 46, 61, 65, 66, 47, - 82, 138, 48, 55, 111, 55, 108, 57, 88, 47, - 75, 138, 47, 79, 8, 43, 49, 83, 84, 92, - 94, 125, 131, 112, 106, 72, 43, 49, 76, 84, - 92, 94, 125, 61, 50, 43, 124, 124, 124, 124, - 132, 138, 43, 123, 123, 123, 124, 126, 17, 18, - 19, 43, 49, 92, 94, 133, 135, 136, 137, 8, - 127, 128, 134, 50, 43, 43, 47, 113, 127, 50 + 37, 38, 39, 78, 85, 90, 92, 93, 95, 100, + 101, 102, 105, 123, 130, 131, 139, 0, 10, 12, + 13, 14, 15, 43, 63, 67, 68, 70, 71, 78, + 131, 46, 46, 53, 117, 119, 118, 46, 46, 8, + 130, 130, 124, 125, 139, 53, 53, 125, 125, 44, + 51, 54, 56, 91, 51, 130, 8, 61, 62, 62, + 8, 93, 95, 98, 69, 139, 3, 108, 108, 115, + 47, 114, 120, 121, 122, 139, 120, 120, 108, 108, + 79, 51, 9, 94, 96, 108, 5, 6, 103, 110, + 111, 112, 113, 139, 112, 6, 104, 107, 108, 139, + 8, 106, 86, 72, 44, 13, 45, 8, 9, 116, + 49, 47, 121, 52, 57, 50, 81, 139, 85, 90, + 92, 97, 99, 114, 114, 47, 52, 55, 112, 47, + 57, 4, 55, 109, 44, 54, 56, 87, 88, 89, + 98, 139, 50, 74, 139, 8, 64, 61, 114, 8, + 80, 82, 48, 52, 113, 113, 107, 107, 108, 112, + 104, 52, 47, 8, 73, 75, 48, 46, 61, 65, + 66, 47, 83, 139, 48, 55, 112, 55, 109, 57, + 89, 47, 76, 139, 47, 80, 8, 43, 49, 84, + 85, 93, 95, 126, 132, 113, 107, 73, 43, 49, + 77, 85, 93, 95, 126, 61, 50, 43, 125, 125, + 125, 125, 133, 139, 43, 124, 124, 124, 125, 127, + 17, 18, 19, 43, 49, 93, 95, 134, 136, 137, + 138, 8, 128, 129, 135, 50, 43, 43, 47, 114, + 128, 50 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -871,7 +879,7 @@ static const unsigned char yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +#define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily @@ -899,53 +907,20 @@ do \ } \ while (0) - #define YYTERROR 1 #define YYERRCODE 256 +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ -/* 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 (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 (0) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #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 @@ -968,30 +943,36 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ - Type, Value); \ + Token, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | +| TOP (cinluded). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (short *bottom, short *top) #else static void yy_stack_print (bottom, top) - short int *bottom; - short int *top; + short *bottom; + short *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -1041,7 +1022,8 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -1059,6 +1041,10 @@ int yydebug; SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -1140,15 +1126,15 @@ yysymprint (yyoutput, yytype, yyvaluep) (void) yyvaluep; if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif switch (yytype) { default: @@ -1164,11 +1150,10 @@ yysymprint (yyoutput, yytype, yyvaluep) #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +yydestruct (int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; +yydestruct (yytype, yyvaluep) int yytype; YYSTYPE *yyvaluep; #endif @@ -1176,10 +1161,6 @@ yydestruct (yymsg, yytype, yyvaluep) /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) { @@ -1207,10 +1188,10 @@ int yyparse (); -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1246,7 +1227,7 @@ yyparse () int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ + /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -1258,9 +1239,9 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - register short int *yyssp; + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -1297,9 +1278,6 @@ yyparse () yyssp = yyss; yyvsp = yyvs; - - yyvsp[0] = yylval; - goto yysetstate; /*------------------------------------------------------------. @@ -1325,7 +1303,7 @@ yyparse () these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; + short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -1353,7 +1331,7 @@ yyparse () yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -1389,18 +1367,18 @@ yyparse () yybackup: /* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ +/* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to look-ahead token. */ + /* 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 look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1415,7 +1393,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1435,8 +1413,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1488,19 +1466,19 @@ yyreduce: case 4: #line 171 "dcParser.yxx" { - parameter_description = (yyvsp[0].u.field); + parameter_description = yyvsp[0].u.field; } break; case 7: #line 180 "dcParser.yxx" { - if (!dc_file->add_class((yyvsp[0].u.dclass))) { - DCClass *old_class = dc_file->get_class_by_name((yyvsp[0].u.dclass)->get_name()); + if (!dc_file->add_class(yyvsp[0].u.dclass)) { + DCClass *old_class = dc_file->get_class_by_name(yyvsp[0].u.dclass->get_name()); if (old_class != (DCClass *)NULL && old_class->is_bogus_class()) { - yyerror("Base class defined after its first reference: " + (yyvsp[0].u.dclass)->get_name()); + yyerror("Base class defined after its first reference: " + yyvsp[0].u.dclass->get_name()); } else { - yyerror("Duplicate class name: " + (yyvsp[0].u.dclass)->get_name()); + yyerror("Duplicate class name: " + yyvsp[0].u.dclass->get_name()); } } } @@ -1509,8 +1487,8 @@ yyreduce: case 8: #line 191 "dcParser.yxx" { - if (!dc_file->add_switch((yyvsp[0].u.dswitch))) { - yyerror("Duplicate class name: " + (yyvsp[0].u.dswitch)->get_name()); + if (!dc_file->add_switch(yyvsp[0].u.dswitch)) { + yyerror("Duplicate class name: " + yyvsp[0].u.dswitch->get_name()); } } break; @@ -1518,28 +1496,28 @@ yyreduce: case 13: #line 204 "dcParser.yxx" { - (yyval.str) = (yyvsp[-2].str) + string("/") + (yyvsp[0].str); + yyval.str = yyvsp[-2].str + string("/") + yyvsp[0].str; } break; case 15: #line 212 "dcParser.yxx" { - (yyval.str) = (yyvsp[-2].str) + string(".") + (yyvsp[0].str); + yyval.str = yyvsp[-2].str + string(".") + yyvsp[0].str; } break; case 16: #line 219 "dcParser.yxx" { - dc_file->add_import_module((yyvsp[0].str)); + dc_file->add_import_module(yyvsp[0].str); } break; case 17: #line 223 "dcParser.yxx" { - dc_file->add_import_module((yyvsp[-1].str)); + dc_file->add_import_module(yyvsp[-1].str); } break; @@ -1553,22 +1531,22 @@ yyreduce: case 21: #line 239 "dcParser.yxx" { - dc_file->add_import_symbol((yyvsp[0].str)); + dc_file->add_import_symbol(yyvsp[0].str); } break; case 22: #line 243 "dcParser.yxx" { - dc_file->add_import_symbol((yyvsp[0].str)); + dc_file->add_import_symbol(yyvsp[0].str); } break; case 23: #line 250 "dcParser.yxx" { - if ((yyvsp[0].u.parameter) != (DCParameter *)NULL) { - DCTypedef *dtypedef = new DCTypedef((yyvsp[0].u.parameter)); + if (yyvsp[0].u.parameter != (DCParameter *)NULL) { + DCTypedef *dtypedef = new DCTypedef(yyvsp[0].u.parameter); if (!dc_file->add_typedef(dtypedef)) { DCTypedef *old_typedef = dc_file->get_typedef_by_name(dtypedef->get_name()); @@ -1582,322 +1560,290 @@ yyreduce: } break; - case 24: -#line 268 "dcParser.yxx" + case 26: +#line 273 "dcParser.yxx" { - dc_file->add_keyword((yyvsp[0].str)); + dc_file->add_keyword(yyvsp[0].str); } break; - case 25: -#line 272 "dcParser.yxx" + case 27: +#line 277 "dcParser.yxx" { // This keyword has already been defined. But since we are now // explicitly defining it, clear its bitmask, so that we will have a // new hash code--doing this will allow us to phase out the // historical hash code support later. - ((DCKeyword *)(yyvsp[0].u.keyword))->clear_historical_flag(); -} - break; - - case 28: -#line 288 "dcParser.yxx" - { - (yyval.u.dclass) = current_class; - current_class = new DCClass(dc_file, (yyvsp[0].str), false, false); -} - break; - - case 29: -#line 293 "dcParser.yxx" - { - (yyval.u.dclass) = current_class; - current_class = (yyvsp[-4].u.dclass); + ((DCKeyword *)yyvsp[0].u.keyword)->clear_historical_flag(); } break; case 30: -#line 301 "dcParser.yxx" +#line 293 "dcParser.yxx" + { + yyval.u.dclass = current_class; + current_class = new DCClass(dc_file, yyvsp[0].str, false, false); +} + break; + + case 31: +#line 298 "dcParser.yxx" + { + yyval.u.dclass = current_class; + current_class = yyvsp[-4].u.dclass; +} + break; + + case 32: +#line 306 "dcParser.yxx" { if (dc_file == (DCFile *)NULL) { yyerror("No DCFile available, so no class names are predefined."); - (yyval.u.dclass) = NULL; + yyval.u.dclass = NULL; } else { - DCClass *dclass = dc_file->get_class_by_name((yyvsp[0].str)); + DCClass *dclass = dc_file->get_class_by_name(yyvsp[0].str); if (dclass == (DCClass *)NULL) { // Create a bogus class as a forward reference. - dclass = new DCClass(dc_file, (yyvsp[0].str), false, true); + dclass = new DCClass(dc_file, yyvsp[0].str, false, true); dc_file->add_class(dclass); } if (dclass->is_struct()) { yyerror("struct name not allowed"); } - (yyval.u.dclass) = dclass; + yyval.u.dclass = dclass; } } break; - case 33: -#line 329 "dcParser.yxx" + case 35: +#line 334 "dcParser.yxx" { - if ((yyvsp[0].u.dclass) != (DCClass *)NULL) { - current_class->add_parent((yyvsp[0].u.dclass)); + if (yyvsp[0].u.dclass != (DCClass *)NULL) { + current_class->add_parent(yyvsp[0].u.dclass); } } break; - case 34: -#line 335 "dcParser.yxx" + case 36: +#line 340 "dcParser.yxx" { if (!dc_multiple_inheritance) { yyerror("Multiple inheritance is not supported without \"dc-multiple-inheritance 1\" in your Config.prc file."); } else { - if ((yyvsp[0].u.dclass) != (DCClass *)NULL) { - current_class->add_parent((yyvsp[0].u.dclass)); + if (yyvsp[0].u.dclass != (DCClass *)NULL) { + current_class->add_parent(yyvsp[0].u.dclass); } } } break; - case 37: -#line 351 "dcParser.yxx" + case 39: +#line 356 "dcParser.yxx" { - if ((yyvsp[-1].u.field) == (DCField *)NULL) { + if (yyvsp[-1].u.field == (DCField *)NULL) { // Pass this error up. - } else if (!current_class->add_field((yyvsp[-1].u.field))) { - yyerror("Duplicate field name: " + (yyvsp[-1].u.field)->get_name()); - } else if ((yyvsp[-1].u.field)->get_number() < 0) { + } else if (!current_class->add_field(yyvsp[-1].u.field)) { + yyerror("Duplicate field name: " + yyvsp[-1].u.field->get_name()); + } else if (yyvsp[-1].u.field->get_number() < 0) { yyerror("A non-network field cannot be stored on a dclass"); } } break; - case 38: -#line 364 "dcParser.yxx" + case 40: +#line 369 "dcParser.yxx" { - if ((yyvsp[-1].u.field) != (DCField *)NULL) { - if ((yyvsp[-1].u.field)->get_name().empty()) { + if (yyvsp[-1].u.field != (DCField *)NULL) { + if (yyvsp[-1].u.field->get_name().empty()) { yyerror("Field name required."); } - (yyvsp[-1].u.field)->copy_keywords(current_keyword_list); + yyvsp[-1].u.field->copy_keywords(current_keyword_list); } - (yyval.u.field) = (yyvsp[-1].u.field); -} - break; - - case 40: -#line 375 "dcParser.yxx" - { - yyerror("Unnamed parameters are not allowed on a dclass"); - if ((yyvsp[-1].u.parameter) != (DCField *)NULL) { - (yyvsp[-1].u.parameter)->copy_keywords(current_keyword_list); - } - (yyval.u.field) = (yyvsp[-1].u.parameter); -} - break; - - case 41: -#line 383 "dcParser.yxx" - { - if ((yyvsp[-1].u.parameter) != (DCField *)NULL) { - (yyvsp[-1].u.parameter)->copy_keywords(current_keyword_list); - } - (yyval.u.field) = (yyvsp[-1].u.parameter); + yyval.u.field = yyvsp[-1].u.field; } break; case 42: -#line 393 "dcParser.yxx" +#line 380 "dcParser.yxx" { - (yyval.u.dclass) = current_class; - current_class = new DCClass(dc_file, (yyvsp[0].str), true, false); + yyerror("Unnamed parameters are not allowed on a dclass"); + if (yyvsp[-1].u.parameter != (DCField *)NULL) { + yyvsp[-1].u.parameter->copy_keywords(current_keyword_list); + } + yyval.u.field = yyvsp[-1].u.parameter; } break; case 43: -#line 398 "dcParser.yxx" +#line 388 "dcParser.yxx" { - (yyval.u.dclass) = current_class; - current_class = (yyvsp[-4].u.dclass); + if (yyvsp[-1].u.parameter != (DCField *)NULL) { + yyvsp[-1].u.parameter->copy_keywords(current_keyword_list); + } + yyval.u.field = yyvsp[-1].u.parameter; } break; case 44: -#line 406 "dcParser.yxx" +#line 398 "dcParser.yxx" + { + yyval.u.dclass = current_class; + current_class = new DCClass(dc_file, yyvsp[0].str, true, false); +} + break; + + case 45: +#line 403 "dcParser.yxx" + { + yyval.u.dclass = current_class; + current_class = yyvsp[-4].u.dclass; +} + break; + + case 46: +#line 411 "dcParser.yxx" { if (dc_file == (DCFile *)NULL) { yyerror("No DCFile available, so no struct names are predefined."); - (yyval.u.dclass) = NULL; + yyval.u.dclass = NULL; } else { - DCClass *dstruct = dc_file->get_class_by_name((yyvsp[0].str)); + DCClass *dstruct = dc_file->get_class_by_name(yyvsp[0].str); if (dstruct == (DCClass *)NULL) { // Create a bogus class as a forward reference. - dstruct = new DCClass(dc_file, (yyvsp[0].str), false, true); + dstruct = new DCClass(dc_file, yyvsp[0].str, false, true); dc_file->add_class(dstruct); } if (!dstruct->is_struct()) { yyerror("struct name required"); } - (yyval.u.dclass) = dstruct; + yyval.u.dclass = dstruct; } } break; - case 47: -#line 434 "dcParser.yxx" + case 49: +#line 439 "dcParser.yxx" { - if ((yyvsp[0].u.dclass) != (DCClass *)NULL) { - current_class->add_parent((yyvsp[0].u.dclass)); + if (yyvsp[0].u.dclass != (DCClass *)NULL) { + current_class->add_parent(yyvsp[0].u.dclass); } } break; - case 48: -#line 440 "dcParser.yxx" + case 50: +#line 445 "dcParser.yxx" { - if ((yyvsp[0].u.dclass) != (DCClass *)NULL) { - current_class->add_parent((yyvsp[0].u.dclass)); + if (yyvsp[0].u.dclass != (DCClass *)NULL) { + current_class->add_parent(yyvsp[0].u.dclass); } } break; - case 51: -#line 451 "dcParser.yxx" + case 53: +#line 456 "dcParser.yxx" { - if ((yyvsp[-1].u.field) == (DCField *)NULL) { + if (yyvsp[-1].u.field == (DCField *)NULL) { // Pass this error up. - } else if (!current_class->add_field((yyvsp[-1].u.field))) { - yyerror("Duplicate field name: " + (yyvsp[-1].u.field)->get_name()); + } else if (!current_class->add_field(yyvsp[-1].u.field)) { + yyerror("Duplicate field name: " + yyvsp[-1].u.field->get_name()); } } break; - case 52: -#line 462 "dcParser.yxx" - { - if ((yyvsp[-1].u.field)->get_name().empty()) { - yyerror("Field name required."); - } - (yyval.u.field) = (yyvsp[-1].u.field); -} - break; - case 54: -#line 470 "dcParser.yxx" +#line 467 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[-1].u.parameter); -} - break; - - case 55: -#line 474 "dcParser.yxx" - { - (yyval.u.field) = (yyvsp[-1].u.parameter); + if (yyvsp[-1].u.field->get_name().empty()) { + yyerror("Field name required."); + } + yyval.u.field = yyvsp[-1].u.field; } break; case 56: -#line 481 "dcParser.yxx" +#line 475 "dcParser.yxx" { - (yyval.u.field) = current_atomic; - if (current_class == (DCClass *)NULL) { - yyerror("Cannot define a method outside of a struct or class."); - DCClass *temp_class = new DCClass(dc_file, "temp", false, false); // memory leak. - current_atomic = new DCAtomicField((yyvsp[-1].str), temp_class); - } else { - current_atomic = new DCAtomicField((yyvsp[-1].str), current_class); - } + yyval.u.field = yyvsp[-1].u.parameter; } break; case 57: -#line 492 "dcParser.yxx" +#line 479 "dcParser.yxx" { - (yyval.u.field) = current_atomic; - current_atomic = (yyvsp[-2].u.atomic); + yyval.u.field = yyvsp[-1].u.parameter; } break; - case 62: -#line 510 "dcParser.yxx" + case 58: +#line 486 "dcParser.yxx" { - if ((yyvsp[0].u.parameter) != (DCParameter *)NULL) { - current_atomic->add_element((yyvsp[0].u.parameter)); + yyval.u.field = current_atomic; + if (current_class == (DCClass *)NULL) { + yyerror("Cannot define a method outside of a struct or class."); + DCClass *temp_class = new DCClass(dc_file, "temp", false, false); // memory leak. + current_atomic = new DCAtomicField(yyvsp[-1].str, temp_class); + } else { + current_atomic = new DCAtomicField(yyvsp[-1].str, current_class); } } break; - case 63: -#line 519 "dcParser.yxx" + case 59: +#line 497 "dcParser.yxx" { - current_parameter = (yyvsp[0].u.parameter); + yyval.u.field = current_atomic; + current_atomic = yyvsp[-2].u.atomic; } break; case 64: -#line 523 "dcParser.yxx" +#line 515 "dcParser.yxx" { - (yyval.u.parameter) = (yyvsp[0].u.parameter); + if (yyvsp[0].u.parameter != (DCParameter *)NULL) { + current_atomic->add_element(yyvsp[0].u.parameter); + } } break; - case 67: -#line 535 "dcParser.yxx" + case 65: +#line 524 "dcParser.yxx" + { + current_parameter = yyvsp[0].u.parameter; +} + break; + + case 66: +#line 528 "dcParser.yxx" + { + yyval.u.parameter = yyvsp[0].u.parameter; +} + break; + + case 69: +#line 540 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); - if ((yyvsp[-1].u.parameter) != (DCField *)NULL) { - current_packer->begin_pack((yyvsp[-1].u.parameter)); - } -} - break; - - case 68: -#line 543 "dcParser.yxx" - { - bool is_valid = false; - if ((yyvsp[-3].u.parameter) != (DCField *)NULL) { - is_valid = (yyvsp[-3].u.parameter)->is_valid(); - } - if (current_packer->end_pack()) { - (yyvsp[-3].u.parameter)->set_default_value(current_packer->get_string()); - - } else { - if (is_valid) { - yyerror("Invalid default value for type"); - } - // If the current parameter isn't valid, we don't mind a pack - // error (there's no way for us to validate the syntax). So we'll - // just ignore the default value in this case. + if (yyvsp[-1].u.parameter != (DCField *)NULL) { + current_packer->begin_pack(yyvsp[-1].u.parameter); } } break; case 70: -#line 565 "dcParser.yxx" - { - current_packer = &default_packer; - current_packer->clear_data(); - if ((yyvsp[-1].u.parameter) != (DCField *)NULL) { - current_packer->begin_pack((yyvsp[-1].u.parameter)); - } -} - break; - - case 71: -#line 573 "dcParser.yxx" +#line 548 "dcParser.yxx" { bool is_valid = false; - if ((yyvsp[-3].u.parameter) != (DCField *)NULL) { - is_valid = (yyvsp[-3].u.parameter)->is_valid(); + if (yyvsp[-3].u.parameter != (DCField *)NULL) { + is_valid = yyvsp[-3].u.parameter->is_valid(); } if (current_packer->end_pack()) { - (yyvsp[-3].u.parameter)->set_default_value(current_packer->get_string()); + yyvsp[-3].u.parameter->set_default_value(current_packer->get_string()); } else { if (is_valid) { @@ -1910,322 +1856,354 @@ yyreduce: } break; - case 76: -#line 604 "dcParser.yxx" + case 72: +#line 570 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[0].u.parameter); + current_packer = &default_packer; + current_packer->clear_data(); + if (yyvsp[-1].u.parameter != (DCField *)NULL) { + current_packer->begin_pack(yyvsp[-1].u.parameter); + } } break; - case 77: -#line 608 "dcParser.yxx" + case 73: +#line 578 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[0].u.field); + bool is_valid = false; + if (yyvsp[-3].u.parameter != (DCField *)NULL) { + is_valid = yyvsp[-3].u.parameter->is_valid(); + } + if (current_packer->end_pack()) { + yyvsp[-3].u.parameter->set_default_value(current_packer->get_string()); + + } else { + if (is_valid) { + yyerror("Invalid default value for type"); + } + // If the current parameter isn't valid, we don't mind a pack + // error (there's no way for us to validate the syntax). So we'll + // just ignore the default value in this case. + } } break; case 78: -#line 615 "dcParser.yxx" +#line 609 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[-1].u.field); + yyval.u.field = yyvsp[0].u.parameter; } break; case 79: -#line 619 "dcParser.yxx" +#line 613 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[-1].u.parameter); + yyval.u.field = yyvsp[0].u.field; } break; case 80: -#line 623 "dcParser.yxx" +#line 620 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[-1].u.parameter); + yyval.u.field = yyvsp[-1].u.field; } break; case 81: -#line 630 "dcParser.yxx" +#line 624 "dcParser.yxx" { - (yyval.u.parameter) = new DCSimpleParameter((yyvsp[0].u.subatomic)); + yyval.u.field = yyvsp[-1].u.parameter; } break; case 82: -#line 634 "dcParser.yxx" +#line 628 "dcParser.yxx" { - DCSimpleParameter *simple_param = (yyvsp[-3].u.parameter)->as_simple_parameter(); - nassertr(simple_param != (DCSimpleParameter *)NULL, 0); - if (!simple_param->set_range(double_range)) { - yyerror("Inappropriate range for type"); - } - (yyval.u.parameter) = simple_param; + yyval.u.field = yyvsp[-1].u.parameter; } break; case 83: -#line 643 "dcParser.yxx" +#line 635 "dcParser.yxx" { - DCSimpleParameter *simple_param = (yyvsp[-2].u.parameter)->as_simple_parameter(); + yyval.u.parameter = new DCSimpleParameter(yyvsp[0].u.subatomic); +} + break; + + case 84: +#line 639 "dcParser.yxx" + { + DCSimpleParameter *simple_param = yyvsp[-3].u.parameter->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); + if (!simple_param->set_range(double_range)) { + yyerror("Inappropriate range for type"); + } + yyval.u.parameter = simple_param; +} + break; + + case 85: +#line 648 "dcParser.yxx" + { + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); nassertr(simple_param != (DCSimpleParameter *)NULL, 0); if (!simple_param->is_numeric_type()) { yyerror("A divisor is only valid on a numeric type."); - } else if (!simple_param->set_divisor((yyvsp[0].u.s_uint))) { + } else if (!simple_param->set_divisor(yyvsp[0].u.s_uint)) { yyerror("Invalid divisor."); } else if (simple_param->has_modulus() && !simple_param->set_modulus(simple_param->get_modulus())) { // Changing the divisor may change the valid range for the modulus. yyerror("Invalid modulus."); } - (yyval.u.parameter) = simple_param; -} - break; - - case 84: -#line 659 "dcParser.yxx" - { - DCSimpleParameter *simple_param = (yyvsp[-2].u.parameter)->as_simple_parameter(); - nassertr(simple_param != (DCSimpleParameter *)NULL, 0); - if (!simple_param->is_numeric_type()) { - yyerror("A divisor is only valid on a numeric type."); - - } else if (!simple_param->set_modulus((yyvsp[0].u.real))) { - yyerror("Invalid modulus."); - } - (yyval.u.parameter) = simple_param; + yyval.u.parameter = simple_param; } break; case 86: -#line 675 "dcParser.yxx" +#line 664 "dcParser.yxx" + { + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); + if (!simple_param->is_numeric_type()) { + yyerror("A divisor is only valid on a numeric type."); + + } else if (!simple_param->set_modulus(yyvsp[0].u.real)) { + yyerror("Invalid modulus."); + } + yyval.u.parameter = simple_param; +} + break; + + case 88: +#line 680 "dcParser.yxx" { if (dc_file == (DCFile *)NULL) { yyerror("Invalid type."); - (yyval.u.parameter) = NULL; + yyval.u.parameter = NULL; } else { - DCTypedef *dtypedef = dc_file->get_typedef_by_name((yyvsp[0].str)); + DCTypedef *dtypedef = dc_file->get_typedef_by_name(yyvsp[0].str); if (dtypedef == (DCTypedef *)NULL) { // Maybe it's a class name. - DCClass *dclass = dc_file->get_class_by_name((yyvsp[0].str)); + DCClass *dclass = dc_file->get_class_by_name(yyvsp[0].str); if (dclass != (DCClass *)NULL) { // Create an implicit typedef for this. dtypedef = new DCTypedef(new DCClassParameter(dclass), true); } else { // Maybe it's a switch name. - DCSwitch *dswitch = dc_file->get_switch_by_name((yyvsp[0].str)); + DCSwitch *dswitch = dc_file->get_switch_by_name(yyvsp[0].str); if (dswitch != (DCSwitch *)NULL) { // This also gets an implicit typedef. dtypedef = new DCTypedef(new DCSwitchParameter(dswitch), true); } else { // It's an undefined typedef. Create a bogus forward reference. - dtypedef = new DCTypedef((yyvsp[0].str)); + dtypedef = new DCTypedef(yyvsp[0].str); } } dc_file->add_typedef(dtypedef); } - (yyval.u.parameter) = dtypedef->make_new_parameter(); - } -} - break; - - case 87: -#line 707 "dcParser.yxx" - { - // This is an inline struct definition. - if ((yyvsp[0].u.dclass) == (DCClass *)NULL) { - (yyval.u.parameter) = NULL; - } else { - if (dc_file != (DCFile *)NULL) { - dc_file->add_thing_to_delete((yyvsp[0].u.dclass)); - } else { - // This is a memory leak--this happens when we put an anonymous - // struct reference within the string passed to - // DCPackerInterface::check_match(). Maybe it doesn't really matter. - } - (yyval.u.parameter) = new DCClassParameter((yyvsp[0].u.dclass)); - } -} - break; - - case 88: -#line 723 "dcParser.yxx" - { - // This is an inline switch definition. - if ((yyvsp[0].u.dswitch) == (DCSwitch *)NULL) { - (yyval.u.parameter) = NULL; - } else { - if (dc_file != (DCFile *)NULL) { - dc_file->add_thing_to_delete((yyvsp[0].u.dswitch)); - } else { - // This is a memory leak--this happens when we put an anonymous - // switch reference within the string passed to - // DCPackerInterface::check_match(). Maybe it doesn't really matter. - } - (yyval.u.parameter) = new DCSwitchParameter((yyvsp[0].u.dswitch)); + yyval.u.parameter = dtypedef->make_new_parameter(); } } break; case 89: -#line 742 "dcParser.yxx" +#line 712 "dcParser.yxx" { - double_range.clear(); + // This is an inline struct definition. + if (yyvsp[0].u.dclass == (DCClass *)NULL) { + yyval.u.parameter = NULL; + } else { + if (dc_file != (DCFile *)NULL) { + dc_file->add_thing_to_delete(yyvsp[0].u.dclass); + } else { + // This is a memory leak--this happens when we put an anonymous + // struct reference within the string passed to + // DCPackerInterface::check_match(). Maybe it doesn't really matter. + } + yyval.u.parameter = new DCClassParameter(yyvsp[0].u.dclass); + } } break; case 90: -#line 746 "dcParser.yxx" +#line 728 "dcParser.yxx" { - double_range.clear(); - if (!double_range.add_range((yyvsp[0].u.real), (yyvsp[0].u.real))) { - yyerror("Overlapping range"); + // This is an inline switch definition. + if (yyvsp[0].u.dswitch == (DCSwitch *)NULL) { + yyval.u.parameter = NULL; + } else { + if (dc_file != (DCFile *)NULL) { + dc_file->add_thing_to_delete(yyvsp[0].u.dswitch); + } else { + // This is a memory leak--this happens when we put an anonymous + // switch reference within the string passed to + // DCPackerInterface::check_match(). Maybe it doesn't really matter. + } + yyval.u.parameter = new DCSwitchParameter(yyvsp[0].u.dswitch); } } break; case 91: -#line 753 "dcParser.yxx" +#line 747 "dcParser.yxx" { double_range.clear(); - if (!double_range.add_range((yyvsp[-2].u.real), (yyvsp[0].u.real))) { - yyerror("Overlapping range"); - } } break; case 92: -#line 760 "dcParser.yxx" +#line 751 "dcParser.yxx" { double_range.clear(); - if ((yyvsp[0].u.real) >= 0) { - yyerror("Syntax error"); - } else if (!double_range.add_range((yyvsp[-1].u.real), -(yyvsp[0].u.real))) { + if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); } } break; case 93: -#line 769 "dcParser.yxx" +#line 758 "dcParser.yxx" { - if (!double_range.add_range((yyvsp[0].u.real), (yyvsp[0].u.real))) { + double_range.clear(); + if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); } } break; case 94: -#line 775 "dcParser.yxx" +#line 765 "dcParser.yxx" { - if (!double_range.add_range((yyvsp[-2].u.real), (yyvsp[0].u.real))) { + double_range.clear(); + if (yyvsp[0].u.real >= 0) { + yyerror("Syntax error"); + } else if (!double_range.add_range(yyvsp[-1].u.real, -yyvsp[0].u.real)) { yyerror("Overlapping range"); } } break; case 95: -#line 781 "dcParser.yxx" +#line 774 "dcParser.yxx" { - if ((yyvsp[0].u.real) >= 0) { - yyerror("Syntax error"); - } else if (!double_range.add_range((yyvsp[-1].u.real), -(yyvsp[0].u.real))) { + if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); } } break; case 96: -#line 792 "dcParser.yxx" +#line 780 "dcParser.yxx" { - uint_range.clear(); + if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } } break; case 97: -#line 796 "dcParser.yxx" +#line 786 "dcParser.yxx" { - uint_range.clear(); - if (!uint_range.add_range((yyvsp[0].u.s_uint), (yyvsp[0].u.s_uint))) { + if (yyvsp[0].u.real >= 0) { + yyerror("Syntax error"); + } else if (!double_range.add_range(yyvsp[-1].u.real, -yyvsp[0].u.real)) { yyerror("Overlapping range"); } } break; case 98: -#line 803 "dcParser.yxx" +#line 797 "dcParser.yxx" { uint_range.clear(); - if (!uint_range.add_range((yyvsp[-2].u.s_uint), (yyvsp[0].u.s_uint))) { - yyerror("Overlapping range"); - } } break; case 99: -#line 810 "dcParser.yxx" +#line 801 "dcParser.yxx" { uint_range.clear(); - if (!uint_range.add_range((yyvsp[-1].u.s_uint), (yyvsp[0].u.s_uint))) { + if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); } } break; case 100: -#line 817 "dcParser.yxx" +#line 808 "dcParser.yxx" { - if (!uint_range.add_range((yyvsp[0].u.s_uint), (yyvsp[0].u.s_uint))) { + uint_range.clear(); + if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); } } break; case 101: -#line 823 "dcParser.yxx" +#line 815 "dcParser.yxx" { - if (!uint_range.add_range((yyvsp[-2].u.s_uint), (yyvsp[0].u.s_uint))) { + uint_range.clear(); + if (!uint_range.add_range(yyvsp[-1].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); } } break; case 102: -#line 829 "dcParser.yxx" +#line 822 "dcParser.yxx" { - if (!uint_range.add_range((yyvsp[-1].u.s_uint), (yyvsp[0].u.s_uint))) { + if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { + yyerror("Overlapping range"); + } +} + break; + + case 103: +#line 828 "dcParser.yxx" + { + if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); } } break; case 104: -#line 839 "dcParser.yxx" +#line 834 "dcParser.yxx" { - if ((yyvsp[-3].u.parameter) == (DCParameter *)NULL) { - (yyval.u.parameter) = NULL; - } else { - (yyval.u.parameter) = (yyvsp[-3].u.parameter)->append_array_specification(uint_range); + if (!uint_range.add_range(yyvsp[-1].u.s_uint, yyvsp[0].u.s_uint)) { + yyerror("Overlapping range"); } } break; - case 105: -#line 850 "dcParser.yxx" + case 106: +#line 844 "dcParser.yxx" { - current_parameter->set_name((yyvsp[0].str)); - (yyval.u.parameter) = current_parameter; + if (yyvsp[-3].u.parameter == (DCParameter *)NULL) { + yyval.u.parameter = NULL; + } else { + yyval.u.parameter = yyvsp[-3].u.parameter->append_array_specification(uint_range); + } } break; - case 106: + case 107: #line 855 "dcParser.yxx" { - DCSimpleParameter *simple_param = (yyvsp[-2].u.parameter)->as_simple_parameter(); + current_parameter->set_name(yyvsp[0].str); + yyval.u.parameter = current_parameter; +} + break; + + case 108: +#line 860 "dcParser.yxx" + { + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) { yyerror("A divisor is only allowed on a primitive type."); @@ -2233,17 +2211,17 @@ yyreduce: yyerror("A divisor is only valid on a numeric type."); } else { - if (!simple_param->set_divisor((yyvsp[0].u.s_uint))) { + if (!simple_param->set_divisor(yyvsp[0].u.s_uint)) { yyerror("Invalid divisor."); } } } break; - case 107: -#line 870 "dcParser.yxx" + case 109: +#line 875 "dcParser.yxx" { - DCSimpleParameter *simple_param = (yyvsp[-2].u.parameter)->as_simple_parameter(); + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) { yyerror("A modulus is only allowed on a primitive type."); @@ -2251,378 +2229,378 @@ yyreduce: yyerror("A modulus is only valid on a numeric type."); } else { - if (!simple_param->set_modulus((yyvsp[0].u.real))) { + if (!simple_param->set_modulus(yyvsp[0].u.real)) { yyerror("Invalid modulus."); } } } break; - case 108: -#line 885 "dcParser.yxx" + case 110: +#line 890 "dcParser.yxx" { - (yyval.u.parameter) = (yyvsp[-3].u.parameter)->append_array_specification(uint_range); -} - break; - - case 109: -#line 892 "dcParser.yxx" - { - if ((yyvsp[0].str).length() != 1) { - yyerror("Single character required."); - (yyval.u.s_uint) = 0; - } else { - (yyval.u.s_uint) = (unsigned char)(yyvsp[0].str)[0]; - } + yyval.u.parameter = yyvsp[-3].u.parameter->append_array_specification(uint_range); } break; case 111: -#line 905 "dcParser.yxx" +#line 897 "dcParser.yxx" { - (yyval.u.s_uint) = (unsigned int)(yyvsp[0].u.uint64); - if ((yyval.u.s_uint) != (yyvsp[0].u.uint64)) { - yyerror("Number out of range."); - (yyval.u.s_uint) = 1; + if (yyvsp[0].str.length() != 1) { + yyerror("Single character required."); + yyval.u.s_uint = 0; + } else { + yyval.u.s_uint = (unsigned char)yyvsp[0].str[0]; } } break; - case 112: -#line 916 "dcParser.yxx" + case 113: +#line 910 "dcParser.yxx" { - (yyval.u.s_uint) = (unsigned int)-(yyvsp[0].u.int64); - if ((yyvsp[0].u.int64) >= 0) { + yyval.u.s_uint = (unsigned int)yyvsp[0].u.uint64; + if (yyval.u.s_uint != yyvsp[0].u.uint64) { + yyerror("Number out of range."); + yyval.u.s_uint = 1; + } +} + break; + + case 114: +#line 921 "dcParser.yxx" + { + yyval.u.s_uint = (unsigned int)-yyvsp[0].u.int64; + if (yyvsp[0].u.int64 >= 0) { yyerror("Syntax error."); - } else if ((yyval.u.s_uint) != -(yyvsp[0].u.int64)) { + } else if (yyval.u.s_uint != -yyvsp[0].u.int64) { yyerror("Number out of range."); - (yyval.u.s_uint) = 1; + yyval.u.s_uint = 1; } } break; - case 115: -#line 938 "dcParser.yxx" + case 117: +#line 943 "dcParser.yxx" { - (yyval.u.real) = (double)(yyvsp[0].u.uint64); -} - break; - - case 116: -#line 942 "dcParser.yxx" - { - (yyval.u.real) = (double)(yyvsp[0].u.int64); + yyval.u.real = (double)yyvsp[0].u.uint64; } break; case 118: -#line 950 "dcParser.yxx" +#line 947 "dcParser.yxx" { - if ((yyvsp[0].str).length() != 1) { - yyerror("Single character required."); - (yyval.u.real) = 0; - } else { - (yyval.u.real) = (double)(unsigned char)(yyvsp[0].str)[0]; - } + yyval.u.real = (double)yyvsp[0].u.int64; } break; case 120: -#line 964 "dcParser.yxx" +#line 955 "dcParser.yxx" { - (yyval) = (yyvsp[0]); + if (yyvsp[0].str.length() != 1) { + yyerror("Single character required."); + yyval.u.real = 0; + } else { + yyval.u.real = (double)(unsigned char)yyvsp[0].str[0]; + } } break; - case 121: -#line 968 "dcParser.yxx" + case 122: +#line 969 "dcParser.yxx" { - if ((yyvsp[-1].str) != current_packer->get_current_field_name()) { + yyval = yyvsp[0]; +} + break; + + case 123: +#line 973 "dcParser.yxx" + { + if (yyvsp[-1].str != current_packer->get_current_field_name()) { ostringstream strm; - strm << "Got '" << (yyvsp[-1].str) << "', expected '" + strm << "Got '" << yyvsp[-1].str << "', expected '" << current_packer->get_current_field_name() << "'"; yyerror(strm.str()); } } break; - case 122: -#line 977 "dcParser.yxx" - { - (yyval) = (yyvsp[0]); -} - break; - - case 123: -#line 984 "dcParser.yxx" - { - current_packer->pack_int64((yyvsp[0].u.int64)); -} - break; - case 124: -#line 988 "dcParser.yxx" +#line 982 "dcParser.yxx" { - current_packer->pack_uint64((yyvsp[0].u.uint64)); + yyval = yyvsp[0]; } break; case 125: -#line 992 "dcParser.yxx" +#line 989 "dcParser.yxx" { - current_packer->pack_double((yyvsp[0].u.real)); + current_packer->pack_int64(yyvsp[0].u.int64); } break; case 126: -#line 996 "dcParser.yxx" +#line 993 "dcParser.yxx" { - current_packer->pack_string((yyvsp[0].str)); + current_packer->pack_uint64(yyvsp[0].u.uint64); } break; case 127: -#line 1000 "dcParser.yxx" +#line 997 "dcParser.yxx" { - current_packer->pack_literal_value((yyvsp[0].str)); + current_packer->pack_double(yyvsp[0].u.real); } break; case 128: -#line 1004 "dcParser.yxx" +#line 1001 "dcParser.yxx" { - current_packer->push(); + current_packer->pack_string(yyvsp[0].str); } break; case 129: -#line 1008 "dcParser.yxx" +#line 1005 "dcParser.yxx" { - current_packer->pop(); + current_packer->pack_literal_value(yyvsp[0].str); } break; case 130: -#line 1012 "dcParser.yxx" +#line 1009 "dcParser.yxx" { current_packer->push(); } break; case 131: -#line 1016 "dcParser.yxx" +#line 1013 "dcParser.yxx" { current_packer->pop(); } break; case 132: -#line 1020 "dcParser.yxx" +#line 1017 "dcParser.yxx" { current_packer->push(); } break; case 133: -#line 1024 "dcParser.yxx" +#line 1021 "dcParser.yxx" { current_packer->pop(); } break; case 134: -#line 1028 "dcParser.yxx" +#line 1025 "dcParser.yxx" { - for (unsigned int i = 0; i < (yyvsp[0].u.s_uint); i++) { - current_packer->pack_int64((yyvsp[-2].u.int64)); - } + current_packer->push(); } break; case 135: -#line 1034 "dcParser.yxx" +#line 1029 "dcParser.yxx" { - for (unsigned int i = 0; i < (yyvsp[0].u.s_uint); i++) { - current_packer->pack_uint64((yyvsp[-2].u.uint64)); - } + current_packer->pop(); } break; case 136: -#line 1040 "dcParser.yxx" +#line 1033 "dcParser.yxx" { - for (unsigned int i = 0; i < (yyvsp[0].u.s_uint); i++) { - current_packer->pack_double((yyvsp[-2].u.real)); + for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { + current_packer->pack_int64(yyvsp[-2].u.int64); } } break; case 137: -#line 1046 "dcParser.yxx" +#line 1039 "dcParser.yxx" { - for (unsigned int i = 0; i < (yyvsp[0].u.s_uint); i++) { - current_packer->pack_literal_value((yyvsp[-2].str)); + for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { + current_packer->pack_uint64(yyvsp[-2].u.uint64); } } break; - case 144: -#line 1070 "dcParser.yxx" + case 138: +#line 1045 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int8; + for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { + current_packer->pack_double(yyvsp[-2].u.real); + } } break; - case 145: -#line 1074 "dcParser.yxx" + case 139: +#line 1051 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int16; + for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { + current_packer->pack_literal_value(yyvsp[-2].str); + } } break; case 146: -#line 1078 "dcParser.yxx" +#line 1075 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int32; + yyval.u.subatomic = ST_int8; } break; case 147: -#line 1082 "dcParser.yxx" +#line 1079 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int64; + yyval.u.subatomic = ST_int16; } break; case 148: -#line 1086 "dcParser.yxx" +#line 1083 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint8; + yyval.u.subatomic = ST_int32; } break; case 149: -#line 1090 "dcParser.yxx" +#line 1087 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint16; + yyval.u.subatomic = ST_int64; } break; case 150: -#line 1094 "dcParser.yxx" +#line 1091 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint32; + yyval.u.subatomic = ST_uint8; } break; case 151: -#line 1098 "dcParser.yxx" +#line 1095 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint64; + yyval.u.subatomic = ST_uint16; } break; case 152: -#line 1102 "dcParser.yxx" +#line 1099 "dcParser.yxx" { - (yyval.u.subatomic) = ST_float64; + yyval.u.subatomic = ST_uint32; } break; case 153: -#line 1106 "dcParser.yxx" +#line 1103 "dcParser.yxx" { - (yyval.u.subatomic) = ST_string; + yyval.u.subatomic = ST_uint64; } break; case 154: -#line 1110 "dcParser.yxx" +#line 1107 "dcParser.yxx" { - (yyval.u.subatomic) = ST_blob; + yyval.u.subatomic = ST_float64; } break; case 155: -#line 1114 "dcParser.yxx" +#line 1111 "dcParser.yxx" { - (yyval.u.subatomic) = ST_blob32; + yyval.u.subatomic = ST_string; } break; case 156: -#line 1118 "dcParser.yxx" +#line 1115 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int8array; + yyval.u.subatomic = ST_blob; } break; case 157: -#line 1122 "dcParser.yxx" +#line 1119 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int16array; + yyval.u.subatomic = ST_blob32; } break; case 158: -#line 1126 "dcParser.yxx" +#line 1123 "dcParser.yxx" { - (yyval.u.subatomic) = ST_int32array; + yyval.u.subatomic = ST_int8array; } break; case 159: -#line 1130 "dcParser.yxx" +#line 1127 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint8array; + yyval.u.subatomic = ST_int16array; } break; case 160: -#line 1134 "dcParser.yxx" +#line 1131 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint16array; + yyval.u.subatomic = ST_int32array; } break; case 161: -#line 1138 "dcParser.yxx" +#line 1135 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint32array; + yyval.u.subatomic = ST_uint8array; } break; case 162: -#line 1142 "dcParser.yxx" +#line 1139 "dcParser.yxx" { - (yyval.u.subatomic) = ST_uint32uint8array; + yyval.u.subatomic = ST_uint16array; } break; case 163: -#line 1146 "dcParser.yxx" +#line 1143 "dcParser.yxx" { - (yyval.u.subatomic) = ST_char; + yyval.u.subatomic = ST_uint32array; } break; case 164: -#line 1153 "dcParser.yxx" +#line 1147 "dcParser.yxx" + { + yyval.u.subatomic = ST_uint32uint8array; +} + break; + + case 165: +#line 1151 "dcParser.yxx" + { + yyval.u.subatomic = ST_char; +} + break; + + case 166: +#line 1158 "dcParser.yxx" { current_keyword_list.clear_keywords(); } break; - case 165: -#line 1157 "dcParser.yxx" + case 167: +#line 1162 "dcParser.yxx" { - current_keyword_list.add_keyword((yyvsp[0].u.keyword)); + current_keyword_list.add_keyword(yyvsp[0].u.keyword); } break; - case 166: -#line 1164 "dcParser.yxx" + case 168: +#line 1169 "dcParser.yxx" { if (current_keyword_list.get_num_keywords() != 0) { yyerror("Communication keywords are not allowed here."); @@ -2630,97 +2608,97 @@ yyreduce: } break; - case 167: -#line 1173 "dcParser.yxx" - { - current_molecular = new DCMolecularField((yyvsp[-1].str), current_class); -} - break; - - case 168: -#line 1177 "dcParser.yxx" - { - (yyval.u.field) = current_molecular; -} - break; - case 169: -#line 1184 "dcParser.yxx" +#line 1178 "dcParser.yxx" { - DCField *field = current_class->get_field_by_name((yyvsp[0].str)); - (yyval.u.atomic) = (DCAtomicField *)NULL; - if (field == (DCField *)NULL) { - yyerror("Unknown field: " + (yyvsp[0].str)); - } else { - (yyval.u.atomic) = field->as_atomic_field(); - if ((yyval.u.atomic) == (DCAtomicField *)NULL) { - yyerror("Not an atomic field: " + (yyvsp[0].str)); - } - } + current_molecular = new DCMolecularField(yyvsp[-1].str, current_class); } break; case 170: -#line 1200 "dcParser.yxx" +#line 1182 "dcParser.yxx" { - if ((yyvsp[0].u.atomic) != (DCAtomicField *)NULL) { - current_molecular->add_atomic((yyvsp[0].u.atomic)); - } + yyval.u.field = current_molecular; } break; case 171: -#line 1206 "dcParser.yxx" +#line 1189 "dcParser.yxx" { - if ((yyvsp[0].u.atomic) != (DCAtomicField *)NULL) { - current_molecular->add_atomic((yyvsp[0].u.atomic)); - if (!current_molecular->compare_keywords(*(yyvsp[0].u.atomic))) { - yyerror("Mismatched keywords in molecule between " + - current_molecular->get_atomic(0)->get_name() + " and " + - (yyvsp[0].u.atomic)->get_name()); + DCField *field = current_class->get_field_by_name(yyvsp[0].str); + yyval.u.atomic = (DCAtomicField *)NULL; + if (field == (DCField *)NULL) { + yyerror("Unknown field: " + yyvsp[0].str); + } else { + yyval.u.atomic = field->as_atomic_field(); + if (yyval.u.atomic == (DCAtomicField *)NULL) { + yyerror("Not an atomic field: " + yyvsp[0].str); } } } break; case 172: -#line 1220 "dcParser.yxx" +#line 1205 "dcParser.yxx" { - (yyval.str) = ""; + if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { + current_molecular->add_atomic(yyvsp[0].u.atomic); + } } break; - case 174: -#line 1228 "dcParser.yxx" + case 173: +#line 1211 "dcParser.yxx" { - (yyval.u.dswitch) = current_switch; - current_switch = new DCSwitch((yyvsp[-4].str), (yyvsp[-2].u.field)); -} - break; - - case 175: -#line 1233 "dcParser.yxx" - { - (yyval.u.dswitch) = current_switch; - current_switch = (DCSwitch *)(yyvsp[-2].u.parameter); -} - break; - - case 181: -#line 1247 "dcParser.yxx" - { - if (!current_switch->is_field_valid()) { - yyerror("case declaration required before first element"); - } else if ((yyvsp[-1].u.field) != (DCField *)NULL) { - if (!current_switch->add_field((yyvsp[-1].u.field))) { - yyerror("Duplicate field name: " + (yyvsp[-1].u.field)->get_name()); + if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { + current_molecular->add_atomic(yyvsp[0].u.atomic); + if (!current_molecular->compare_keywords(*yyvsp[0].u.atomic)) { + yyerror("Mismatched keywords in molecule between " + + current_molecular->get_atomic(0)->get_name() + " and " + + yyvsp[0].u.atomic->get_name()); } } } break; - case 182: -#line 1260 "dcParser.yxx" + case 174: +#line 1225 "dcParser.yxx" + { + yyval.str = ""; +} + break; + + case 176: +#line 1233 "dcParser.yxx" + { + yyval.u.dswitch = current_switch; + current_switch = new DCSwitch(yyvsp[-4].str, yyvsp[-2].u.field); +} + break; + + case 177: +#line 1238 "dcParser.yxx" + { + yyval.u.dswitch = current_switch; + current_switch = (DCSwitch *)yyvsp[-2].u.parameter; +} + break; + + case 183: +#line 1252 "dcParser.yxx" + { + if (!current_switch->is_field_valid()) { + yyerror("case declaration required before first element"); + } else if (yyvsp[-1].u.field != (DCField *)NULL) { + if (!current_switch->add_field(yyvsp[-1].u.field)) { + yyerror("Duplicate field name: " + yyvsp[-1].u.field->get_name()); + } + } +} + break; + + case 184: +#line 1265 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); @@ -2728,8 +2706,8 @@ yyreduce: } break; - case 183: -#line 1266 "dcParser.yxx" + case 185: +#line 1271 "dcParser.yxx" { if (!current_packer->end_pack()) { yyerror("Invalid value for switch parameter"); @@ -2743,8 +2721,8 @@ yyreduce: } break; - case 184: -#line 1281 "dcParser.yxx" + case 186: +#line 1286 "dcParser.yxx" { if (!current_switch->add_default()) { yyerror("Default case already defined"); @@ -2752,32 +2730,32 @@ yyreduce: } break; - case 185: -#line 1290 "dcParser.yxx" + case 187: +#line 1295 "dcParser.yxx" { current_switch->add_break(); } break; - case 186: -#line 1297 "dcParser.yxx" + case 188: +#line 1302 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[0].u.parameter); + yyval.u.field = yyvsp[0].u.parameter; } break; - case 187: -#line 1301 "dcParser.yxx" + case 189: +#line 1306 "dcParser.yxx" { - (yyval.u.field) = (yyvsp[0].u.parameter); + yyval.u.field = yyvsp[0].u.parameter; } break; } -/* Line 1037 of yacc.c. */ -#line 2781 "y.tab.c" +/* Line 999 of yacc.c. */ +#line 2759 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -2877,57 +2855,38 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* 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) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ - if (yychar == YYEOF) - for (;;) - { - - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - yydestruct ("Error: popping", - yystos[*yyssp], yyvsp); - } + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; } - else - { - yydestruct ("Error: discarding", yytoken, &yylval); - yychar = YYEMPTY; - } + + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; + } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) - goto yyerrorlab; -#endif - -yyvsp -= yylen; - yyssp -= yylen; - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ @@ -2949,22 +2908,22 @@ yyerrlab1: if (yyssp == yyss) YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; - yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; + YYDPRINTF ((stderr, "Shifting error token, ")); + *++yyvsp = yylval; - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - yystate = yyn; goto yynewstate; @@ -2980,9 +2939,6 @@ yyacceptlab: | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yydestruct ("Error: discarding lookahead", - yytoken, &yylval); - yychar = YYEMPTY; yyresult = 1; goto yyreturn; diff --git a/direct/src/dcparser/dcParser.h.prebuilt b/direct/src/dcparser/dcParser.h.prebuilt index 339e62c0e5..ded31c5a3e 100644 --- a/direct/src/dcparser/dcParser.h.prebuilt +++ b/direct/src/dcparser/dcParser.h.prebuilt @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.0. */ +/* A Bison parser, made by GNU Bison 1.875b. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index bbda4e0f25..00a9ba53eb 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -264,11 +264,16 @@ typedef_decl: ; keyword_decl: - KW_KEYWORD IDENTIFIER + KW_KEYWORD keyword_decl_list + ; + +keyword_decl_list: + empty + | keyword_decl_list IDENTIFIER { dc_file->add_keyword($2); } - | KW_KEYWORD KEYWORD + | keyword_decl_list KEYWORD { // This keyword has already been defined. But since we are now // explicitly defining it, clear its bitmask, so that we will have a