diff --git a/VERSIONS b/VERSIONS index 1304735ba..38bac76b9 100644 --- a/VERSIONS +++ b/VERSIONS @@ -5,6 +5,8 @@ ChucK VERSIONS log 1.5.3.3 ======= - (fixed) specific internal UGen connection error now handled without exiting +- (fixed, windows) single letter filenames without extensions (e.g., "A") now + are distinguished from windows drive letters (e.g., "A:\") 1.5.3.2 (October 2024) @@ -12,7 +14,7 @@ ChucK VERSIONS log *** ChuGL maintanance patch *** - (updated) backend WebGPU version to wgpu-22.1.0.5 - (added) OpenGL fallback on machines where modern graphics APIs (vulkan, metal, direct3d) - are not supported + are not supported - (fixed) shreds can now exit a GG.nextFrame() loop without hanging the window - (added) GG.unregisterShred() to manually unregister a graphics shred - (added) new examples diff --git a/src/core/chuck.cpp b/src/core/chuck.cpp index 92e6df8ac..e51bb7dc8 100644 --- a/src/core/chuck.cpp +++ b/src/core/chuck.cpp @@ -764,11 +764,9 @@ t_CKBOOL ChucK::initChugins() // push indent EM_pushlog(); - // SPENCERTODO: what to do for full path - std::string full_path = filename; - // parse, type-check, and emit - if( compiler()->go( filename, full_path ) ) + // NOTE: filename here should already be a fullpath + if( compiler()->compileFile( filename ) ) { // preserve op overloads | 1.5.1.5 compiler()->env()->op_registry.preserve(); @@ -1167,12 +1165,8 @@ t_CKBOOL ChucK::compileFile( const std::string & path, goto error; } - // construct full path to be associated with the file so me.sourceDir() works - // (added 1.3.0.0) - full_path = get_full_path(filename); - // parse, type-check, and emit (full_path added 1.3.0.0) - if( !m_carrier->compiler->go( filename, full_path ) ) + if( !m_carrier->compiler->compileFile( filename ) ) goto error; // get the code @@ -1265,7 +1259,7 @@ t_CKBOOL ChucK::compileCode( const std::string & code, EM_pushlog(); // falsify filename / path for various logs - std::string theThing = "compiled.code:" + argsTogether; + std::string theThing = std::string(CHUCK_CODE_LITERAL_SIGNIFIER) + ":" + argsTogether; std::string fakefakeFilename = ""; // parse out command line arguments @@ -1277,22 +1271,14 @@ t_CKBOOL ChucK::compileCode( const std::string & code, goto error; } - // working directory - workingDir = getParamString( CHUCK_PARAM_WORKING_DIRECTORY ); - - // construct full path to be associated with the file so me.sourceDir() works - full_path = workingDir + "/compiled.code"; - // log - EM_log( CK_LOG_FINE, "full path: %s...", full_path.c_str() ); - - // parse, type-check, and emit (full_path added 1.3.0.0) - if( !m_carrier->compiler->go( "", full_path, code ) ) + // parse, type-check, and emit + if( !m_carrier->compiler->compileCode( code ) ) goto error; // get the code vm_code = m_carrier->compiler->output(); // (re) name it (no path to append) | 1.5.0.5 (ge) update from '+=' to '=' - vm_code->name = "compiled.code"; + vm_code->name = CHUCK_CODE_LITERAL_SIGNIFIER; // log EM_log( CK_LOG_FINE, "sporking %d %s...", count, diff --git a/src/core/chuck.h b/src/core/chuck.h index a3c60b274..3b2144456 100644 --- a/src/core/chuck.h +++ b/src/core/chuck.h @@ -110,6 +110,9 @@ #define CHUCK_PARAM_USER_CHUGINS CHUCK_PARAM_CHUGIN_LIST_USER #define CHUCK_PARAM_USER_CHUGIN_DIRECTORIES CHUCK_PARAM_CHUGIN_LIST_USER_DIR +// code literal signifier +#define CHUCK_CODE_LITERAL_SIGNIFIER "" + diff --git a/src/core/chuck.lex b/src/core/chuck.lex index 2134e9fd7..d4c0bd7ba 100644 --- a/src/core/chuck.lex +++ b/src/core/chuck.lex @@ -379,6 +379,7 @@ global { adjust(); return GLOBAL; } "@operator" { adjust(); return AT_OP; } "@construct" { adjust(); return AT_CTOR; } "@destruct" { adjust(); return AT_DTOR; } +"@import" { adjust(); return AT_IMPORT; } "->" { adjust(); return ARROW_RIGHT; } "<-" { adjust(); return ARROW_LEFT; } "-->" { adjust(); return GRUCK_RIGHT; } diff --git a/src/core/chuck.y b/src/core/chuck.y index 87b6f122c..51e8b61a9 100644 --- a/src/core/chuck.y +++ b/src/core/chuck.y @@ -98,6 +98,7 @@ a_Program g_program = NULL; a_Complex complex_exp; a_Polar polar_exp; a_Vec vec_exp; // ge: added 1.3.5.3 + a_Import import; // 1.5.2.5 (ge) added }; // expect shift/reduce conflicts @@ -107,7 +108,8 @@ a_Program g_program = NULL; // 1.4.0.0: changed to 41 for global keyword // 1.4.0.1: changed to 79 for left recursion // 1.5.1.1: changed to 80 for trailing comma in array literals -%expect 82 +// 1.5.2.5: changed to 84 for @import statements +%expect 84 %token ID STRING_LIT CHAR_LIT %token INT_VAL @@ -135,7 +137,7 @@ a_Program g_program = NULL; PUBLIC PROTECTED PRIVATE STATIC ABSTRACT CONST SPORK ARROW_RIGHT ARROW_LEFT L_HACK R_HACK GRUCK_RIGHT GRUCK_LEFT UNGRUCK_RIGHT UNGRUCK_LEFT - AT_OP AT_CTOR AT_DTOR + AT_OP AT_CTOR AT_DTOR AT_IMPORT %type program @@ -156,6 +158,7 @@ a_Program g_program = NULL; %type selection_statement %type jump_statement %type expression_statement +%type import_statement %type expression %type chuck_expression %type arrow_expression @@ -197,6 +200,8 @@ a_Program g_program = NULL; %type complex_exp %type polar_exp %type vec_exp // ge: added 1.3.5.3 +%type import_target // 1.5.2.5 (ge) added +%type import_list // 1.5.2.5 (ge) added %start program @@ -355,6 +360,7 @@ statement | jump_statement { $$ = $1; } // | label_statement { } | code_segment { $$ = $1; } + | import_statement { $$ = $1; } ; jump_statement @@ -370,7 +376,7 @@ selection_statement | IF LPAREN expression RPAREN statement ELSE statement { $$ = new_stmt_from_if( $3, $5, $7, @1.first_line, @1.first_column ); } ; - + loop_statement : WHILE LPAREN expression RPAREN statement { $$ = new_stmt_from_while( $3, $5, @1.first_line, @1.first_column ); } @@ -394,7 +400,21 @@ code_segment : LBRACE RBRACE { $$ = new_stmt_from_code( NULL, @1.first_line, @1.first_column ); } | LBRACE statement_list RBRACE { $$ = new_stmt_from_code( $2, @1.first_line, @1.first_column ); } ; - + +import_statement + : AT_IMPORT import_target { $$ = new_stmt_from_import( $2, @1.first_line, @1.first_column );} + | AT_IMPORT LBRACE import_list RBRACE { $$ = new_stmt_from_import( $3, @1.first_line, @1.first_column );} + ; + +import_list + : import_target { $$ = $1; } + | import_target COMMA import_list { $$ = prepend_import( $1, $3, @1.first_line, @1.first_column ); } + +import_target + : STRING_LIT { $$ = new_import( $1, NULL, @1.first_line, @1.first_column ); } + // | id_dot { $$ = new_import( NULL, $1, @1.first_line, @1.first_column ); } + ; + expression_statement : SEMICOLON { $$ = NULL; } | expression SEMICOLON { $$ = new_stmt_from_expression( $1, @1.first_line, @1.first_column ); } @@ -402,11 +422,11 @@ expression_statement expression : chuck_expression { $$ = $1; } - | expression COMMA chuck_expression { $$ = append_expression( $1, $3, @1.first_line, @1.first_column ); } + | expression COMMA chuck_expression { $$ = append_expression( $1, $3, @1.first_line, @1.first_column ); } ; chuck_expression - : arrow_expression { $$ = $1; } + : arrow_expression { $$ = $1; } | chuck_expression chuck_operator arrow_expression { $$ = new_exp_from_binary( $1, $2, $3, @2.first_line, @2.first_column ); } ; diff --git a/src/core/chuck_absyn.cpp b/src/core/chuck_absyn.cpp index adc7bb4a1..38da75b54 100644 --- a/src/core/chuck_absyn.cpp +++ b/src/core/chuck_absyn.cpp @@ -33,6 +33,7 @@ #include "chuck_errmsg.h" #include #include +#include #include // 1.5.1.5 for string concat @@ -342,23 +343,85 @@ a_Stmt new_stmt_from_case( a_Exp exp, uint32_t lineNum, uint32_t posNum ) return a; } +a_Stmt new_stmt_from_import( a_Import list, uint32_t line, uint32_t where ) // 1.5.2.5 (ge) added +{ + a_Stmt a = (a_Stmt)checked_malloc( sizeof(struct a_Stmt_) ); + a->s_type = ae_stmt_import; + a->stmt_import.list = list; + a->line = line; a->where = where; + a->stmt_import.line = line; a->stmt_import.where = where; + a->stmt_import.self = a; + + return a; +} + +a_Import new_import( c_str str, a_Id_List list, uint32_t line, uint32_t where ) // 1.5.2.5 (ge) added +{ + a_Import a = (a_Import)checked_malloc( sizeof(struct a_Import_) ); + + // check which option + if( str ) + { + a->what = str; // no strdup( str ); <-- str should have been allocated in alloc_str() + } + else // id list + { + a_Id_List curr = list; + std::string result = ""; + + // iterate over id list + while( curr ) + { + result += S_name(curr->xid); + // if not the last, appent DOT + if( curr->next ) result += "."; + // set to next + curr = curr->next; + } + + // sum of string lengths, +1 for null terminator + size_t len = result.length() + 1; + // allocate + char * sc = (char *)checked_malloc( len ); + // copy + strncpy( sc, result.c_str(), len ); + // set + a->what = sc; + // clean up id list, since we will not have references to it after this + delete_id_list( list ); + } + + // set line info + a->line = line; a->where = where; + + return a; +} + +a_Import prepend_import( a_Import target, a_Import list, uint32_t lineNum, uint32_t posNum ) +{ + target->next = list; + return target; +} + a_Exp append_expression( a_Exp list, a_Exp exp, uint32_t lineNum, uint32_t posNum ) { - a_Exp current; - current = list->next; - if (current == NULL) { - list->next = exp; - return list; - } + a_Exp current; + current = list->next; + if( current == NULL ) + { + list->next = exp; + return list; + } - while (1) + while( true ) { - if (current->next == NULL) { - current->next = exp; - break; - } else { - current = current->next; - } + if( current->next == NULL ) { + current->next = exp; + break; + } + else { + current = current->next; + } } return list; } @@ -1306,6 +1369,9 @@ void delete_stmt( a_Stmt stmt ) case ae_stmt_gotolabel: delete_stmt_from_label( stmt ); break; + case ae_stmt_import: + delete_stmt_from_import( stmt ); + break; } CK_SAFE_FREE( stmt ); @@ -1388,6 +1454,27 @@ void delete_stmt_from_label( a_Stmt stmt ) // TODO: someting with S_Symbol stmt->gotolabel.name } +void delete_stmt_from_import( a_Stmt stmt ) +{ + EM_log( CK_LOG_FINEST, "deleting stmt %p (import)...", (void *)stmt ); + + // pointer + a_Import next = NULL, i = stmt->stmt_import.list; + + // iterate instead of recurse to avoid stack overflow + while( i ) + { + // delete the content + CK_SAFE_FREE( i->what ); + // get next before we delete this one + next = i->next; + // delete the import target + CK_SAFE_FREE( i ); + // move to the next one + i = next; + } +} + void delete_exp_from_primary( a_Exp_Primary_ & p ) { EM_log( CK_LOG_FINEST, "deleting exp (primary)..." ); diff --git a/src/core/chuck_absyn.h b/src/core/chuck_absyn.h index 2525054e2..53e00cc74 100644 --- a/src/core/chuck_absyn.h +++ b/src/core/chuck_absyn.h @@ -138,6 +138,7 @@ typedef struct a_Stmt_Continue_ * a_Stmt_Continue; typedef struct a_Stmt_Return_ * a_Stmt_Return; typedef struct a_Stmt_Case_ * a_Stmt_Case; typedef struct a_Stmt_GotoLabel_ * a_Stmt_GotoLabel; +typedef struct a_Stmt_Import_ * a_Stmt_Import; typedef struct a_Decl_ * a_Decl; typedef struct a_Var_Decl_ * a_Var_Decl; typedef struct a_Var_Decl_List_ * a_Var_Decl_List; @@ -151,6 +152,7 @@ typedef struct a_Ctor_Call_ * a_Ctor_Call; // 1.5.2.0 (ge) added typedef struct a_Complex_ * a_Complex; typedef struct a_Polar_ * a_Polar; typedef struct a_Vec_ * a_Vec; // ge: added 1.3.5.3 +typedef struct a_Import_ * a_Import; // 1.5.2.5 (ge) added // forward reference for type typedef struct Chuck_Type * t_CKTYPE; @@ -188,6 +190,7 @@ a_Stmt new_stmt_from_continue( uint32_t line, uint32_t where ); a_Stmt new_stmt_from_return( a_Exp exp, uint32_t line, uint32_t where ); a_Stmt new_stmt_from_label( c_str xid, uint32_t line, uint32_t where ); a_Stmt new_stmt_from_case( a_Exp exp, uint32_t line, uint32_t where ); +a_Stmt new_stmt_from_import( a_Import target, uint32_t line, uint32_t where ); a_Exp append_expression( a_Exp list, a_Exp exp, uint32_t line, uint32_t where ); a_Exp new_exp_from_binary( a_Exp lhs, ae_Operator oper, a_Exp rhs, uint32_t line, uint32_t where ); a_Exp new_exp_from_unary( ae_Operator oper, a_Exp exp, uint32_t line, uint32_t where ); @@ -226,6 +229,8 @@ a_Array_Sub prepend_array_sub( a_Array_Sub array, a_Exp exp, uint32_t line, uint a_Complex new_complex( a_Exp re, uint32_t line, uint32_t where ); a_Polar new_polar( a_Exp mod, uint32_t line, uint32_t where ); // ge: added 1.3.5.3 a_Vec new_vec( a_Exp e, uint32_t line, uint32_t where ); +a_Import new_import( c_str str, a_Id_List id_list, uint32_t line, uint32_t where ); +a_Import prepend_import( a_Import target, a_Import list, uint32_t line, uint32_t where ); a_Class_Def new_class_def( ae_Keyword class_decl, a_Id_List xid, a_Class_Ext ext, a_Class_Body body, uint32_t line, uint32_t where ); a_Class_Body new_class_body( a_Section section, uint32_t line, uint32_t where ); @@ -278,6 +283,7 @@ void delete_stmt_from_break( a_Stmt stmt ); void delete_stmt_from_continue( a_Stmt stmt ); void delete_stmt_from_return( a_Stmt stmt ); void delete_stmt_from_label( a_Stmt stmt ); +void delete_stmt_from_import( a_Stmt stmt ); // delete an exp void delete_exp( a_Exp exp ); @@ -348,6 +354,7 @@ struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type; struct a_Complex_ { a_Exp re; a_Exp im; uint32_t line; uint32_t where; a_Exp self; }; struct a_Polar_ { a_Exp mod; a_Exp phase; uint32_t line; uint32_t where; a_Exp self; }; struct a_Vec_ { a_Exp args; int numdims; uint32_t line; uint32_t where; a_Exp self; }; // ge: added 1.3.5.3 +struct a_Import_ { c_str what; a_Import next; uint32_t line; uint32_t where; }; // 1.5.2.5 (ge) added // enum primary exp type typedef enum { ae_primary_var, ae_primary_num, ae_primary_float, @@ -429,6 +436,7 @@ struct a_Stmt_Continue_ { uint32_t line; uint32_t where; a_Stmt self; }; struct a_Stmt_Return_ { a_Exp val; uint32_t line; uint32_t where; a_Stmt self; }; struct a_Stmt_Case_ { a_Exp exp; uint32_t line; uint32_t where; a_Stmt self; }; struct a_Stmt_GotoLabel_ { S_Symbol name; uint32_t line; uint32_t where; a_Stmt self; }; +struct a_Stmt_Import_ { a_Import list; uint32_t line; uint32_t where; a_Stmt self; }; struct a_Stmt_Code_ { // statement list @@ -442,7 +450,8 @@ struct a_Stmt_Code_ // enum values for stmt type typedef enum { ae_stmt_exp, ae_stmt_while, ae_stmt_until, ae_stmt_for, ae_stmt_foreach, ae_stmt_loop, ae_stmt_if, ae_stmt_code, ae_stmt_switch, ae_stmt_break, - ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel + ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel, + ae_stmt_import } ae_Stmt_Type; // a statement @@ -472,6 +481,7 @@ struct a_Stmt_ struct a_Stmt_Return_ stmt_return; struct a_Stmt_Case_ stmt_case; struct a_Stmt_GotoLabel_ stmt_gotolabel; + struct a_Stmt_Import_ stmt_import; }; // code position diff --git a/src/core/chuck_compile.cpp b/src/core/chuck_compile.cpp index 98b5f2559..b044168db 100644 --- a/src/core/chuck_compile.cpp +++ b/src/core/chuck_compile.cpp @@ -27,7 +27,7 @@ // desc: chuck compile system unifying parser, type checker, and emitter // // author: Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu) -// date: Autumn 2005 - original +// date: (see header for information) //----------------------------------------------------------------------------- #include "chuck_compile.h" #include "chuck_lang.h" @@ -50,6 +50,7 @@ #include "ulib_doc.h" #include "ulib_machine.h" #include "ulib_math.h" +#include "util_platforms.h" #include "ulib_std.h" #include "util_string.h" @@ -66,6 +67,7 @@ #include #include #include +#include using namespace std; @@ -75,8 +77,8 @@ using namespace std; t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ); t_CKBOOL load_external_modules( Chuck_Compiler * compiler, const char * extension, - std::list & chugin_search_paths, - std::list & named_dls); + list & chugin_search_paths, + list & named_dls); t_CKBOOL load_module( Chuck_Compiler * compiler, Chuck_Env * env, f_ck_query query, const char * name, const char * nspc ); @@ -186,7 +188,7 @@ void Chuck_Compiler::shutdown() m_recent.clear(); // clean up DLLs - std::list::iterator iter; + list::iterator iter; for( iter = m_dlls.begin(); iter != m_dlls.end(); iter++ ) { // delete each DLL @@ -220,8 +222,8 @@ void Chuck_Compiler::shutdown() // name: bind() // desc: bind a new type system module, via query function //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::bind( f_ck_query query_func, const std::string & name, - const std::string & nspc ) +t_CKBOOL Chuck_Compiler::bind( f_ck_query query_func, const string & name, + const string & nspc ) { // log EM_log( CK_LOG_SYSTEM, "on-demand binding compiler module '%s'...", @@ -286,39 +288,155 @@ void Chuck_Compiler::set_auto_depend( t_CKBOOL v ) //----------------------------------------------------------------------------- -// name: go() +// name: compileFile() // desc: parse, type-check, and emit a program //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::go( const string & filename, - const string & full_path, - const string & codeLiteral ) +t_CKBOOL Chuck_Compiler::compileFile( const string & filename ) { - // hold return value - t_CKBOOL ret = FALSE; + // create a compile target + Chuck_CompileTarget * target = new Chuck_CompileTarget( te_do_all ); - // clear any error messages - EM_reset_msg(); - // set the chuck | 1.5.0.5 (ge) added - EM_set_current_chuck( this->carrier()->chuck ); + // resolve filename locally + if( !target->resolveFilename( filename, NULL, FALSE ) ) + { + // delete target + CK_SAFE_DELETE( target ); + // return + return FALSE; + } - // check to see if resolve dependencies automatically - if( !m_auto_depend ) + // compile target; compile() will memory-manage target (so no need to delete here) + return this->compile( target ); +} + + + +//----------------------------------------------------------------------------- +// name: compileCode() +// desc: parse, type-check, and emit a program +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_Compiler::compileCode( const string & codeLiteral ) +{ + // create a compile target + Chuck_CompileTarget * target = new Chuck_CompileTarget( te_do_all ); + + // set filename to code literal constant + target->filename = CHUCK_CODE_LITERAL_SIGNIFIER; + // get working directory + string workingDir = this->carrier()->chuck->getParamString( CHUCK_PARAM_WORKING_DIRECTORY ); + // construct full path to be associated with the file so me.sourceDir() works + target->absolutePath = workingDir + target->filename; + // set code literal + target->codeLiteral = codeLiteral; + + // compile target; compile() will memory-manage target (so no need to delete here) + return this->compile( target ); +} + + + + +//----------------------------------------------------------------------------- +// name: compile() +// desc: compile a single target +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_Compiler::compile( Chuck_CompileTarget * target ) +{ + // hold return value + t_CKBOOL ret = TRUE; + // compilation sequence + std::vector sequence; + // if cycle encountered, this returns cycle path + std::vector problems; + // local import target node + ImportTargetNode node( target, 0, 0 ); + + // set the chuck + target->the_chuck = this->carrier()->chuck; + // clear in-progress + this->imports()->clearInProgress(); + // add current target to registry to avoid cycles + this->imports()->addInProgress( target ); + // scan for imports + if( !this->scan_imports( target ) ) { - // normal (note: full_path added 1.3.0.0) - ret = this->do_normal_depend( filename, codeLiteral, full_path ); + // error encountered + ret = FALSE; + // clean up + goto cleanup; } - else // auto depend + + // topological sort for serial compilation + if( !this->generate_compile_sequence( &node, sequence, problems ) ) { - // call auto-depend compile (1.4.1.0) - ret = this->do_auto_depend( filename, codeLiteral, full_path ); + // cycle detected + EM_error2( 0, "@import error -- cycle detected:" ); + // print head of cycle + EM_error2( 0, " |- '%s' is imported from...", problems[0]->target->filename.c_str() ); + for( t_CKINT i = 1; i < problems.size()-1; i++ ) + { + // print middle of cycle + EM_error2( 0, " |- '%s':[line %d], which is imported from...", problems[i]->target->filename.c_str(), problems[i-1]->line ); + // log for more detail + EM_log_opts( CK_LOG_INFO, EM_LOG_NO_PREFIX, "[chuck]: |- (full path: '%s')", problems[i]->target->absolutePath.c_str() ); + } + // print origin of cycle + EM_error2( 0, " |- '%s':[line %d] (this is the originating file)", problems.back()->target->filename.c_str(), problems[problems.size()-2]->line ); + // error encountered + ret = FALSE; + // clean up + goto cleanup; } + // iterator over sequence + // NOTE: the base target should be the last one in the sequence + for( t_CKINT i = 0; i < sequence.size(); i++ ) + { + // log + EM_log( CK_LOG_FINER, "compiling import target '%s'...", target->filename.c_str() ); + + // compile dependency (import only) + ret = compile_single( sequence[i]->target ); + if( !ret ) + { + // if there is a container + if( sequence[i]->target->howMuch == te_do_import_only && sequence[i]->target != target ) + { + // set target for printing filename where error is + EM_setCurrentTarget( sequence[i]->target ); + EM_error2( 0, "...in file '%s'", sequence[i]->target->absolutePath.c_str() ); + // set target for error reporting for the originating file + EM_setCurrentTarget( target ); + // report container + EM_error2( 0, "(hint: this an imported file that '%s' depends on...", target->filename.c_str() ); + EM_error2( 0, "...in other words, '%s' directly or indirectly imports '%s')", target->filename.c_str(), sequence[i]->target->filename.c_str() ); + // unset target + EM_setCurrentTarget( NULL ); + } + // error encountered + ret = FALSE; + // clean up + goto cleanup; + } + + // if target was an import (i.e., don't do this with the base target) + if( sequence[i]->target->howMuch == te_do_import_only ) + { + // mark target as complete in registry + this->imports()->markComplete( sequence[i]->target ); + } + } + +cleanup: // 1.4.1.0 (ge) | added to unset the fileName reference, which determines // how messages print to console (e.g., [file.ck]: or [chuck]:) // 1.5.0.5 (ge) | changed to reset_parse() which does more reset // reset the parser, including reset filename and unset current chuck * reset_parse(); + // clear the in-progress list; should include the original target + this->imports()->clearInProgress(); + return ret; } @@ -326,13 +444,73 @@ t_CKBOOL Chuck_Compiler::go( const string & filename, //----------------------------------------------------------------------------- -// name: set_file2parse() -// desc: set a FILE * for one-time use on next go(); see header for details +// name: generate_compile_sequence() +// desc: produce a compilation sequences of targets from a import dependency graph +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_Compiler::generate_compile_sequence( ImportTargetNode * head, + std::vector & sequence, + std::vector & problems ) +{ + // clear return vector + sequence.clear(); + + // sets of markings + std::vector v; + std::set permanent; + std::set temporary; + + // topological sort + if( !visit( head, sequence, permanent, temporary, problems ) ) return FALSE; + + // done + return TRUE; +} + + + + +//----------------------------------------------------------------------------- +// name: visit() +// desc: recursive componet of topological sort function //----------------------------------------------------------------------------- -void Chuck_Compiler::set_file2parse( FILE * fd, t_CKBOOL autoClose ) +t_CKBOOL Chuck_Compiler::visit( ImportTargetNode * node, + std::vector & sequence, + std::set & permanent, + std::set & temporary, + std::vector & problems ) { - // call down to parser - ::fd2parse_set( fd, autoClose ); + // cycle + t_CKBOOL acyclic = TRUE; + // the target + Chuck_CompileTarget * target = node->target; + + // if node already complete, can safely ignore + if( target->state == te_compile_complete ) return TRUE; + // is node marked permanent? + if( permanent.find(target) != permanent.end() ) return TRUE; + // is node marked temporary? if so, CYCLE detected + if( temporary.find(target) != temporary.end() ) + { problems.push_back(node); return FALSE; } + + // add node to temporary + temporary.insert(target); + + // loop over dependencies + for( t_CKINT i = 0; i < target->dependencies.size(); i++ ) + { + // visit dependency + acyclic = visit( &(target->dependencies[i]), sequence, permanent, temporary, problems ); + // if cycle detected + if( !acyclic ) + { problems.push_back(node); return FALSE; } + } + + // add + permanent.insert(target); + // append node (should be prepend, but we will reverse later) + sequence.push_back(node); + + return TRUE; } @@ -352,8 +530,6 @@ t_CKBOOL Chuck_Compiler::resolve( const string & type ) // look up if name is already parsed - - return ret; } @@ -366,7 +542,7 @@ t_CKBOOL Chuck_Compiler::resolve( const string & type ) // with the name of an external UGen, and if so which one //----------------------------------------------------------------------------- void Chuck_Compiler::setReplaceDac( t_CKBOOL shouldReplaceDac, - const std::string & replacement ) + const string & replacement ) { emitter->should_replace_dac = shouldReplaceDac; emitter->dac_replacement = replacement; @@ -376,21 +552,21 @@ void Chuck_Compiler::setReplaceDac( t_CKBOOL shouldReplaceDac, //----------------------------------------------------------------------------- -// name: do_entire_file() -// desc: parse, type-check, and emit a program +// name: compile_entire_file() +// desc: scan, type-check, and emit a program //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::do_entire_file( Chuck_Context * context ) +t_CKBOOL Chuck_Compiler::compile_entire_file( Chuck_Context * context ) { // 0th-scan (pass 0) - if( !type_engine_scan0_prog( env(), g_program, te_do_all ) ) + if( !type_engine_scan0_prog( env(), context->parse_tree, te_do_all ) ) return FALSE; // 1st-scan (pass 1) - if( !type_engine_scan1_prog( env(), g_program, te_do_all ) ) + if( !type_engine_scan1_prog( env(), context->parse_tree, te_do_all ) ) return FALSE; // 2nd-scan (pass 2) - if( !type_engine_scan2_prog( env(), g_program, te_do_all ) ) + if( !type_engine_scan2_prog( env(), context->parse_tree, te_do_all ) ) return FALSE; // check the program (pass 3) @@ -398,8 +574,8 @@ t_CKBOOL Chuck_Compiler::do_entire_file( Chuck_Context * context ) return FALSE; // emit (pass 4) - if( !emit_engine_emit_prog( emitter, g_program ) ) - return FALSE; + this->code = emit_engine_emit_prog( emitter, context->parse_tree, te_do_all ); + if( !code ) return FALSE; // set the state of the context to done context->progress = Chuck_Context::P_ALL_DONE; @@ -411,33 +587,33 @@ t_CKBOOL Chuck_Compiler::do_entire_file( Chuck_Context * context ) //----------------------------------------------------------------------------- -// name: do_only_classes() -// desc: compile only classes definitions +// name: compile_import_only() // 1.5.2.5 (ge) added +// desc: import only public definitions (classes and operator overloads) //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::do_only_classes( Chuck_Context * context ) +t_CKBOOL Chuck_Compiler::compile_import_only( Chuck_Context * context ) { // 0th-scan (pass 0) - if( !type_engine_scan0_prog( env(), g_program, te_do_classes_only ) ) - return FALSE; + if( !type_engine_scan0_prog( env(), context->parse_tree, te_do_import_only ) ) + return FALSE; // 1st-scan (pass 1) - if( !type_engine_scan1_prog( env(), g_program, te_do_classes_only ) ) + if( !type_engine_scan1_prog( env(), context->parse_tree, te_do_import_only ) ) return FALSE; // 2nd-scan (pass 2) - if( !type_engine_scan2_prog( env(), g_program, te_do_classes_only ) ) + if( !type_engine_scan2_prog( env(), context->parse_tree, te_do_import_only ) ) return FALSE; // check the program (pass 3) - if( !type_engine_check_context( env(), context, te_do_classes_only ) ) + if( !type_engine_check_context( env(), context, te_do_import_only ) ) return FALSE; // emit (pass 4) - code = emit_engine_emit_prog( emitter, g_program , te_do_classes_only ); - if( !code ) return FALSE; + if( !emit_engine_emit_prog( emitter, context->parse_tree, te_do_import_only ) ) + return FALSE; // set the state of the context to done - context->progress = Chuck_Context::P_ALL_DONE; + context->progress = Chuck_Context::P_IMPORTED; return TRUE; } @@ -446,27 +622,27 @@ t_CKBOOL Chuck_Compiler::do_only_classes( Chuck_Context * context ) //----------------------------------------------------------------------------- -// name: do_all_except_classes() -// desc: compile everything except classes +// name: compile_all_except_import() +// desc: compile everything except public definitions //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::do_all_except_classes( Chuck_Context * context ) +t_CKBOOL Chuck_Compiler::compile_all_except_import( Chuck_Context * context ) { // 0th scan only deals with classes, so is not needed // 1st-scan (pass 1) - if( !type_engine_scan1_prog( env(), g_program, te_do_no_classes ) ) + if( !type_engine_scan1_prog( env(), context->parse_tree, te_skip_import ) ) return FALSE; // 2nd-scan (pass 2) - if( !type_engine_scan2_prog( env(), g_program, te_do_no_classes ) ) + if( !type_engine_scan2_prog( env(), context->parse_tree, te_skip_import ) ) return FALSE; // check the program (pass 3) - if( !type_engine_check_context( env(), context, te_do_no_classes ) ) + if( !type_engine_check_context( env(), context, te_skip_import ) ) return FALSE; // emit (pass 4) - code = emit_engine_emit_prog( emitter, g_program, te_do_no_classes ); + code = emit_engine_emit_prog( emitter, context->parse_tree, te_skip_import ); if( !code ) return FALSE; // set the state of the context to done @@ -479,72 +655,197 @@ t_CKBOOL Chuck_Compiler::do_all_except_classes( Chuck_Context * context ) //----------------------------------------------------------------------------- -// name: do_normal_depend() -// desc: compile normally without auto-depend +// name: type_engine_scan_import() +// desc: scan for a list of imports //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::do_normal_depend( const string & filename, - const string & codeLiteral, - const string & full_path ) +t_CKBOOL type_engine_scan_import( Chuck_Env * env, a_Stmt_List stmt_list, + Chuck_CompileTarget * target, + Chuck_ImportRegistry * registry ) +{ + // type check the stmt_list + while( stmt_list ) + { + // the current statement + if( stmt_list->stmt && stmt_list->stmt->s_type == ae_stmt_import ) + { + // get the import list + a_Import import = stmt_list->stmt->stmt_import.list; + // loop over import list + while( import ) + { + // lookup to see there is already a target + Chuck_CompileTarget * t = registry->lookup( import->what, target ); + if( !t ) + { + // TODO: look at extension to 1) diff between .ck and .chug + // TODO: if not extension, default to .ck + // make new target with import only + t = new Chuck_CompileTarget( te_do_import_only ); + // set filename, with transplant path, expand search if necessary + if( !t->resolveFilename( import->what, target, TRUE, import->where ) ) + { + // clean up + CK_SAFE_DELETE( t ); + // error encountered, bailing out + return FALSE; + } + // add to registry's in-progress list + registry->addInProgress( t ); + } + // add to target + target->dependencies.push_back( ImportTargetNode( t, import->where, import->line ) ); + // next in list + import = import->next; + } + } + + // advance to the next statement + stmt_list = stmt_list->next; + } + + return TRUE; +} + + + + +//----------------------------------------------------------------------------- +// name: type_engine_scan_import() +// desc: scan for a list of imports +//----------------------------------------------------------------------------- +t_CKBOOL type_engine_scan_import( Chuck_Env * env, + Chuck_CompileTarget * target, + Chuck_ImportRegistry * registry ) { t_CKBOOL ret = TRUE; - Chuck_Context * context = NULL; - // expand - string theFilename = expand_filepath(filename); - string theFullpath = expand_filepath(full_path); + // get AST + a_Program prog = target->AST; + if( !prog ) return FALSE; - // parse the code - if( !chuck_parse( theFilename, codeLiteral ) ) - return FALSE; + // clear target dependencies + target->dependencies.clear(); - // make the context - context = type_engine_make_context( g_program, theFilename ); - if( !context ) return FALSE; + // push indent + EM_pushlog(); - // remember full path (added 1.3.0.0) - context->full_path = theFullpath; + // go through each of the program sections + while( prog && ret ) + { + switch( prog->section->s_type ) + { + case ae_section_stmt: + // scan the statements + ret = type_engine_scan_import( env, prog->section->stmt_list, target, registry ); + break; + + case ae_section_func: + break; + + case ae_section_class: + break; + + default: + EM_error2( prog->where, + "(internal error) unrecognized program section in type checker pre-scan..." ); + ret = FALSE; + break; + } - // reset the env - env()->reset(); + // next section + prog = prog->next; + } - // load the context - if( !type_engine_load_context( env(), context ) ) - return FALSE; + // pop indent + EM_poplog(); - // 0th-scan (pass 0) - if( !type_engine_scan0_prog( env(), g_program, te_do_all ) ) - { ret = FALSE; goto cleanup; } + return ret; +} - // 1st-scan (pass 1) - if( !type_engine_scan1_prog( env(), g_program, te_do_all ) ) - { ret = FALSE; goto cleanup; } - // 2nd-scan (pass 2) - if( !type_engine_scan2_prog( env(), g_program, te_do_all ) ) - { ret = FALSE; goto cleanup; } - // check the program (pass 3) - if( !type_engine_check_context( env(), context, te_do_all ) ) - { ret = FALSE; goto cleanup; } - // emit (pass 4) - code = emit_engine_emit_prog( emitter, g_program, te_do_all ); - if( !code ) { ret = FALSE; goto cleanup; } +//----------------------------------------------------------------------------- +// name: scan_imports() +// desc: scan for @import statements; return a list of resulting import targets +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_Compiler::scan_imports( Chuck_Env * env, + Chuck_CompileTarget * target, + Chuck_ImportRegistry * registry ) +{ + return type_engine_scan_import( env, target, registry ); +} -cleanup: - // commit - if( ret ) env()->global()->commit(); - // or rollback - else env()->global()->rollback(); - // unload the context from the type-checker - if( !type_engine_unload_context( env() ) ) + +//----------------------------------------------------------------------------- +// name: scan_imports() +// desc: scan for imports +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_Compiler::scan_imports( Chuck_CompileTarget * target ) +{ + // return value + t_CKBOOL ret = TRUE; + + // set as current target + EM_setCurrentTarget( target ); + + // parse the code + if( !chuck_parse( target ) ) { - EM_error2( 0, "(internal error) unloading context..." ); - return FALSE; + // error encountered + ret = FALSE; + // clean up + goto cleanup; + } + + // set the AST + target->AST = g_program; + + // log + EM_log( CK_LOG_FINER, "@import scanning within target '%s'...", target->filename.c_str() ); + + // add the current file name to targets (to avoid duplicates/cycles) + // scan for @import statements + if( !scan_imports( env(), target, this->imports() ) ) + { + // error encountered + ret = FALSE; + // bail out + goto cleanup; } + // push log + EM_pushlog(); + // loop over dependencies + for( int i = 0; i < target->dependencies.size(); i++ ) + { + // current dependency + Chuck_CompileTarget * t = target->dependencies[i].target; + // check if we have already parsed + if( t->AST == NULL ) + { + // log + EM_log( CK_LOG_FINER, "dependency found: '%s'", t->absolutePath.c_str() ); + // parse for scan import on imported file + if( !scan_imports( t ) ) + { + // error encountered + ret = FALSE; + // bail out; break here to make sure poplog() is run + break; + } + } + } + // pop log + EM_poplog(); + +cleanup: + // null current target + EM_setCurrentTarget( NULL ); + + // done return ret; } @@ -552,24 +853,25 @@ t_CKBOOL Chuck_Compiler::do_normal_depend( const string & filename, //----------------------------------------------------------------------------- -// name: do_auto_depend() -// desc: compile with auto-depend (TODO: this doesn't work yet, I don't think) +// name: compile_single() +// desc: scan, type-check, emit a single target (post parse and post import) //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::do_auto_depend( const string & filename, - const string & codeLiteral, - const string & full_path ) +t_CKBOOL Chuck_Compiler::compile_single( Chuck_CompileTarget * target ) { t_CKBOOL ret = TRUE; - Chuck_Context * context = NULL; - // parse the code - if( !chuck_parse( filename, codeLiteral ) ) - return FALSE; + // clear any error messages + EM_reset_msg(); + // make the target current in the parser + EM_setCurrentTarget( target ); // make the context - context = type_engine_make_context( g_program, filename ); + Chuck_Context * context = type_engine_make_context( target->AST, target->filename ); if( !context ) return FALSE; + // remember full path (added 1.3.0.0) + context->full_path = target->absolutePath; + // reset the env env()->reset(); @@ -577,21 +879,28 @@ t_CKBOOL Chuck_Compiler::do_auto_depend( const string & filename, if( !type_engine_load_context( env(), context ) ) return FALSE; - // do entire file - if( !do_entire_file( context ) ) - { ret = FALSE; goto cleanup; } - - // get the code - code = context->code(); - if( !code ) + // compile + if( target->howMuch == te_do_all ) { - ret = FALSE; - EM_error2( 0, "(internal error) context->code() NULL!" ); - goto cleanup; + if( !compile_entire_file( context ) ) + { ret = FALSE; goto cleanup; } + } + else if( target->howMuch == te_do_import_only ) + { + if( !compile_import_only( context ) ) + { ret = FALSE; goto cleanup; } + } + else if( target->howMuch == te_skip_import ) + { + if( !compile_all_except_import( context ) ) + { ret = FALSE; goto cleanup; } } cleanup: + // make the target current in the parser + EM_setCurrentTarget( NULL ); + // commit if( ret ) env()->global()->commit(); // or rollback @@ -610,44 +919,6 @@ t_CKBOOL Chuck_Compiler::do_auto_depend( const string & filename, - -//----------------------------------------------------------------------------- -// name: find_recent_path() -// desc: find recent context by path -//----------------------------------------------------------------------------- -Chuck_Context * Chuck_Compiler::find_recent_path( const string & path ) -{ - return NULL; -} - - - - -//----------------------------------------------------------------------------- -// name: find_recent_type() -// desc: find recent context by type name -//----------------------------------------------------------------------------- -Chuck_Context * Chuck_Compiler::find_recent_type( const string & type ) -{ - return NULL; -} - - - - -//----------------------------------------------------------------------------- -// name: add_recent_path() -// desc: add recent context by path -//----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::add_recent_path( const string & path, - Chuck_Context * context ) -{ - return TRUE; -} - - - - //----------------------------------------------------------------------------- // name: output() // desc: get the code generated by the last do() @@ -692,7 +963,7 @@ t_CKBOOL load_module( Chuck_Compiler * compiler, Chuck_Env * env, f_ck_query que //----------------------------------------------------------------------------- // name: load_internal_modules() -// desc: ... +// desc: load internal base modules //----------------------------------------------------------------------------- t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ) { @@ -806,7 +1077,7 @@ t_CKBOOL getDirEntryAttribute( dirent * de, t_CKBOOL & isDirectory, t_CKBOOL & i (de->data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) || (de->data.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)); #elif defined(__WINDOWS_PTHREAD__) // Cygwin -- doesn't have dirent d_type - std::string absolute_path = std::string(directory) + "/" + de->d_name; + string absolute_path = string(directory) + "/" + de->d_name; struct stat st; if( stat(absolute_path.c_str(), &st) == 0 ) { @@ -879,9 +1150,11 @@ static string format_dir_name_for_display( const string & path ) // name: scan_external_modules_in_directory() // desc: scan all external modules by extension within a directory //----------------------------------------------------------------------------- -t_CKBOOL scan_external_modules_in_directory( const char * directory, - const char * extension, t_CKBOOL recursiveSearch, - vector & chugins2load, vector & dirs2search, +t_CKBOOL scan_external_modules_in_directory( const string & directory, + const string & extension, + t_CKBOOL recursiveSearch, + vector & chugins2load, + vector & dirs2search, vector & ckfiles2load ) { // expand directory path @@ -909,7 +1182,7 @@ t_CKBOOL scan_external_modules_in_directory( const char * directory, if( extension_matches( de->d_name, ".ck" ) ) { // construct absolute path - std::string absolute_path = path + "/" + de->d_name; + string absolute_path = path + "/" + de->d_name; // append file path ckfiles2load.push_back( absolute_path ); } @@ -917,7 +1190,7 @@ t_CKBOOL scan_external_modules_in_directory( const char * directory, else if( extension_matches( de->d_name, extension ) ) { // construct absolute path - std::string absolute_path = path + "/" + de->d_name; + string absolute_path = path + "/" + de->d_name; // append module chugins2load.push_back( ChuginFileInfo( de->d_name, absolute_path ) ); } @@ -931,7 +1204,7 @@ t_CKBOOL scan_external_modules_in_directory( const char * directory, strncmp( de->d_name, "..", sizeof( ".." ) ) != 0 ) { // construct absolute path (use the non-expanded path for consistency when printing) - std::string absolute_path = string(directory) + "/" + de->d_name; + string absolute_path = string(directory) + "/" + de->d_name; // queue search in sub-directory dirs2search.push_back( absolute_path ); } @@ -945,7 +1218,7 @@ t_CKBOOL scan_external_modules_in_directory( const char * directory, // on the filesystem it shows up as a directory ending in .chug. // If we see one of these directories, we can dive directly to the Contents/MacOS subfolder // and look for a regular file. | 1.5.0.1 (dbraun) added - std::string absolute_path = path + "/" + de->d_name + "/Contents/MacOS"; + string absolute_path = path + "/" + de->d_name + "/Contents/MacOS"; // probe NAME.chug/Contents/MacOS/NAME string actualName = extension_removed( de->d_name, extension ); // construct @@ -971,31 +1244,44 @@ t_CKBOOL scan_external_modules_in_directory( const char * directory, //----------------------------------------------------------------------------- -// name: load_external_module_at_path() -// desc: ... +// name: logChuginLoad() | 1.5.2.5 (ge) +// desc: local function quick-hand for logging a chugin load +//----------------------------------------------------------------------------- +static void logChuginLoad( const string & name, t_CKINT logLevel ) +{ + // log with no newline; print `[chugin] X.chug` + EM_log_opts( logLevel, EM_LOG_NO_NEWLINE, "[%s] %s ", TC::magenta("chugin",true).c_str(), name.c_str() ); +} + + + + +//----------------------------------------------------------------------------- +// name: load_external_chugin() +// desc: load chugin module by path //----------------------------------------------------------------------------- -t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, - const char * name, - const char * dl_path ) +t_CKBOOL Chuck_Compiler::load_external_chugin( const string & path, const string & name ) { // get env - Chuck_Env * env = compiler->env(); + Chuck_Env * env = this->env(); - // log with no newline; print status next - // NOTE this is more informative if the chugin crashes, we can see the name - EM_log_opts( CK_LOG_HERALD, EM_LOG_NO_NEWLINE, "[%s] %s ", TC::magenta("chugin",true).c_str(), name ); + // NOTE this (verbose >= 5) is more informative if the chugin crashes, we can see the name + EM_log( CK_LOG_INFO, "loading [chugin] %s...", name.c_str() ); - Chuck_DLL * dll = new Chuck_DLL( compiler->carrier(), name ); + // create chuck DLL data structure + Chuck_DLL * dll = new Chuck_DLL( this->carrier(), name != "" ? name.c_str() : (extract_filepath_file(path)).c_str() ); t_CKBOOL query_failed = FALSE; // load (but don't query yet; lazy mode == TRUE) - if( dll->load(dl_path, CK_QUERY_FUNC, TRUE) ) + if( dll->load( path.c_str(), CK_QUERY_FUNC, TRUE) ) { // probe it dll->probe(); // if not compatible if( !dll->compatible() ) { + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_HERALD ); // print EM_log_opts( CK_LOG_HERALD, EM_LOG_NO_PREFIX, "[%s] (API version: %d.%d)", TC::red("FAILED",true).c_str(), dll->versionMajor(), dll->versionMinor() ); // push @@ -1011,6 +1297,8 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, // try to add to type system if( query_failed || !type_engine_add_dll2( env, dll, "global" ) ) { + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_HERALD ); // print EM_log_opts( CK_LOG_HERALD, EM_LOG_NO_PREFIX, "[%s] (API version: %d.%d)", TC::red("FAILED",true).c_str(), dll->versionMajor(), dll->versionMinor() ); EM_pushlog(); @@ -1020,7 +1308,7 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, // print reason EM_log( CK_LOG_HERALD, "reason: %s", TC::orange(dll->last_error(),true).c_str() ); } - EM_log( CK_LOG_HERALD, "%s '%s'...", TC::blue("skipping",true).c_str(), dl_path ); + EM_log( CK_LOG_HERALD, "%s '%s'...", TC::blue("skipping",true).c_str(), path.c_str() ); EM_poplog(); // go to error for cleanup goto error; @@ -1028,7 +1316,9 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, } else { - // print + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_HERALD ); + // print error status EM_log_opts( CK_LOG_HERALD, EM_LOG_NO_PREFIX, "[%s]", TC::red("FAILED",true).c_str() ); // more info EM_pushlog(); @@ -1038,12 +1328,14 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, goto error; } - // print + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_HERALD ); + // print success status EM_log_opts( CK_LOG_HERALD, EM_LOG_NO_PREFIX, "[%s]", TC::green("OK",true).c_str() ); // add to compiler - compiler->m_dlls.push_back(dll); + m_dlls.push_back(dll); // commit operator overloads | 1.5.1.5 - compiler->env()->op_registry.preserve(); + env->op_registry.preserve(); // return home successful return TRUE; @@ -1051,7 +1343,7 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, // clean up CK_SAFE_DELETE( dll ); // rollback operator overloads | 1.5.1.5 - compiler->env()->op_registry.reset2local(); + env->op_registry.reset2local(); return FALSE; } @@ -1063,10 +1355,10 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, // name: load_external_modules_in_directory() // desc: load all external modules by extension within a directory //----------------------------------------------------------------------------- -t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, - const char * directory, - const char * extension, - t_CKBOOL recursiveSearch ) +t_CKBOOL Chuck_Compiler::load_external_modules_in_directory( + const string & directory, + const string & extension, + t_CKBOOL recursiveSearch ) { vector chugins2load; vector dirs2search; @@ -1099,8 +1391,8 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, for( t_CKINT i = 0; i < chugins2load.size(); i++ ) { // load module - t_CKBOOL loaded = load_external_module_at_path( compiler, chugins2load[i].filename.c_str(), - chugins2load[i].path.c_str() ); + t_CKBOOL loaded = this->load_external_chugin( + chugins2load[i].path, chugins2load[i].filename ); // if no error if( chugins2load[i].isBundle && loaded) { // log @@ -1117,7 +1409,7 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, for( t_CKINT i = 0; i < ckfiles2load.size(); i++ ) { // save for later - compiler->m_cklibs_to_preload.push_back( ckfiles2load[i] ); + this->m_cklibs_to_preload.push_back( ckfiles2load[i] ); } // pop log @@ -1127,7 +1419,7 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, for( t_CKINT i = 0; i < dirs2search.size(); i++ ) { // search in dir - load_external_modules_in_directory( compiler, dirs2search[i].c_str(), extension, recursiveSearch ); + load_external_modules_in_directory( dirs2search[i], extension, recursiveSearch ); } return TRUE; @@ -1140,9 +1432,9 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, // name: load_external_modules() // desc: load external modules (e.g., .chug and .ck library files) //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::load_external_modules( const char * extension, - std::list & chugin_search_paths, - std::list & named_dls, +t_CKBOOL Chuck_Compiler::load_external_modules( const string & extension, + list & chugin_search_paths, + list & named_dls, t_CKBOOL recursiveSearch ) { // get env @@ -1155,7 +1447,7 @@ t_CKBOOL Chuck_Compiler::load_external_modules( const char * extension, type_engine_load_context( env, context ); // first load dynamic libraries explicitly named on the command line - for( std::list::iterator i_dl = named_dls.begin(); + for( list::iterator i_dl = named_dls.begin(); i_dl != named_dls.end(); i_dl++ ) { // get chugin name @@ -1163,20 +1455,20 @@ t_CKBOOL Chuck_Compiler::load_external_modules( const char * extension, // expand the filepath (e.g., ~) | 1.5.2.6 (ge) added dl_path = expand_filepath(dl_path); // check extension, append if no match - if( !extension_matches(dl_path.c_str(), extension) ) + if( !extension_matches(dl_path, extension) ) dl_path += extension; // load the module - load_external_module_at_path( this, dl_path.c_str(), dl_path.c_str() ); + load_external_chugin( dl_path ); } // now recurse through search paths and load any DLs or .ck files found - for( std::list::iterator i_sp = chugin_search_paths.begin(); + for( list::iterator i_sp = chugin_search_paths.begin(); i_sp != chugin_search_paths.end(); i_sp++ ) { // expand the filepath (e.g., ~) | 1.5.2.6 (ge) added string dl_path = expand_filepath(*i_sp); // search directory and load contents - load_external_modules_in_directory( this, dl_path.c_str(), extension, recursiveSearch ); + load_external_modules_in_directory( *i_sp, extension, recursiveSearch ); } // clear context @@ -1193,32 +1485,37 @@ t_CKBOOL Chuck_Compiler::load_external_modules( const char * extension, //----------------------------------------------------------------------------- -// name: probe_external_module_at_path() -// desc: probe external module +// name: probe_external_chugin() +// desc: probe external module by path //----------------------------------------------------------------------------- -t_CKBOOL probe_external_module_at_path( const char * name, const char * dl_path ) +t_CKBOOL Chuck_Compiler::probe_external_chugin( const string & path, const string & theName ) { + // name + string name = theName != "" ? theName : extract_filepath_file(path); // create dynamic module - Chuck_DLL * dll = new Chuck_DLL( NULL, name ); + Chuck_DLL * dll = new Chuck_DLL( NULL, name.c_str() ); - // log with no newline; print status next - // NOTE this is more informative if the chugin crashes, we can see the name - EM_log_opts( CK_LOG_SYSTEM, EM_LOG_NO_NEWLINE, "[%s] %s ", TC::magenta("chugin",true).c_str(), name ); + // NOTE this (verbose >= 5) is more informative if the chugin crashes, we can see the name + EM_log( CK_LOG_INFO, "probing [chugin] %s...", name.c_str() ); // load the dll, lazy mode - if( dll->load(dl_path, CK_QUERY_FUNC, TRUE) ) + if( dll->load(path.c_str(), CK_QUERY_FUNC, TRUE) ) { // probe it dll->probe(); // if not compatible if( dll->compatible() ) { + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_SYSTEM ); // print EM_log_opts( CK_LOG_SYSTEM, EM_LOG_NO_PREFIX, "[%s] (API version: %d.%d)", TC::green("OK",true).c_str(), dll->versionMajor(), dll->versionMinor() ); } else { + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_SYSTEM ); // print EM_log_opts( CK_LOG_SYSTEM, EM_LOG_NO_PREFIX, "[%s] (API version: %d.%d)", TC::red("FAILED",true).c_str(), dll->versionMajor(), dll->versionMinor() ); @@ -1229,7 +1526,8 @@ t_CKBOOL probe_external_module_at_path( const char * name, const char * dl_path } // print info if available - string name = dll->name(); + string dllName = dll->name(); + string dllPath = dll->filepath(); string authors = dll->getinfo( CHUGIN_INFO_AUTHORS ); string version = dll->getinfo( CHUGIN_INFO_CHUGIN_VERSION ); string desc = dll->getinfo( CHUGIN_INFO_DESCRIPTION ); @@ -1250,6 +1548,8 @@ t_CKBOOL probe_external_module_at_path( const char * name, const char * dl_path } else { + // print `[chugin] X.chug` + logChuginLoad( name, CK_LOG_SYSTEM ); // print EM_log_opts( CK_LOG_SYSTEM, EM_LOG_NO_PREFIX, "[%s]...", TC::red("FAILED",true).c_str() ); // more info @@ -1264,21 +1564,23 @@ t_CKBOOL probe_external_module_at_path( const char * name, const char * dl_path + //----------------------------------------------------------------------------- // name: probe_external_modules_in_directory() // desc: probe all external modules by extension within a directory //----------------------------------------------------------------------------- -t_CKBOOL probe_external_modules_in_directory( const char * directory, - const char * extension, - t_CKBOOL recursiveSearch, - std::list & ck_libs ) +t_CKBOOL Chuck_Compiler::probe_external_modules_in_directory( + const string & directory, + const string & extension, + t_CKBOOL recursiveSearch, + list & ck_libs ) { vector chugins2load; vector dirs2search; vector ckfiles2load; // print directory to examine - EM_log( CK_LOG_SYSTEM, "searching '%s'", format_dir_name_for_display( directory ).c_str() ); + EM_log( CK_LOG_SYSTEM, "searching '%s'", format_dir_name_for_display(directory).c_str() ); // push EM_pushlog(); @@ -1304,8 +1606,8 @@ t_CKBOOL probe_external_modules_in_directory( const char * directory, for( t_CKINT i = 0; i < chugins2load.size(); i++ ) { // load module - t_CKBOOL probed = probe_external_module_at_path( - chugins2load[i].filename.c_str(), chugins2load[i].path.c_str() ); + t_CKBOOL probed = probe_external_chugin( + chugins2load[i].path, chugins2load[i].filename ); // if no error if( chugins2load[i].isBundle && probed) { // log @@ -1332,7 +1634,7 @@ t_CKBOOL probe_external_modules_in_directory( const char * directory, for( t_CKINT i = 0; i < dirs2search.size(); i++ ) { // search in dir - probe_external_modules_in_directory( dirs2search[i].c_str(), extension, recursiveSearch, ck_libs ); + probe_external_modules_in_directory( dirs2search[i], extension, recursiveSearch, ck_libs ); } return TRUE; @@ -1345,11 +1647,11 @@ t_CKBOOL probe_external_modules_in_directory( const char * directory, // name: probe_external_modules() // desc: probe external modules (e.g., .chug and .ck library files) //----------------------------------------------------------------------------- -t_CKBOOL Chuck_Compiler::probe_external_modules( const char * extension, - std::list & chugin_search_paths, - std::list & named_dls, +t_CKBOOL Chuck_Compiler::probe_external_modules( const string & extension, + list & chugin_search_paths, + list & named_dls, t_CKBOOL recursiveSearch, - std::list & ck_libs ) + list & ck_libs ) { // print EM_log( CK_LOG_SYSTEM, "probing specified chugins (e.g., via --chugin)..." ); @@ -1357,7 +1659,7 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const char * extension, EM_pushlog(); // first load dynamic libraries explicitly named on the command line - for( std::list::iterator i_dl = named_dls.begin(); + for( list::iterator i_dl = named_dls.begin(); i_dl != named_dls.end(); i_dl++ ) { // get chugin name @@ -1365,10 +1667,10 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const char * extension, // expand the filepath (e.g., ~) | 1.5.2.6 (ge) added dl_path = expand_filepath(dl_path); // check extension, append if no match - if( !extension_matches(dl_path.c_str(), extension) ) + if( !extension_matches(dl_path, extension) ) dl_path += extension; // load the module - probe_external_module_at_path( dl_path.c_str(), dl_path.c_str() ); + probe_external_chugin( dl_path, dl_path ); } // check @@ -1383,13 +1685,13 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const char * extension, EM_pushlog(); // now recurse through search paths and load any DLs or .ck files found - for( std::list::iterator i_sp = chugin_search_paths.begin(); + for( list::iterator i_sp = chugin_search_paths.begin(); i_sp != chugin_search_paths.end(); i_sp++ ) { // expand the filepath (e.g., ~) | 1.5.2.6 (ge) added string dl_path = expand_filepath(*i_sp); // search directory and load contents - probe_external_modules_in_directory( dl_path.c_str(), extension, recursiveSearch, ck_libs ); + probe_external_modules_in_directory( dl_path, extension, recursiveSearch, ck_libs ); } // pop @@ -1397,3 +1699,331 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const char * extension, return TRUE; } + + + + +//----------------------------------------------------------------------------- +// name: Chuck_ImportRegistry() +// desc: constructor +//----------------------------------------------------------------------------- +Chuck_ImportRegistry::Chuck_ImportRegistry() +{ } + + + + +//----------------------------------------------------------------------------- +// name: lookupTarget() +// desc: look up if target exists by path (relative or full) +//----------------------------------------------------------------------------- +Chuck_CompileTarget * Chuck_ImportRegistry::lookup( const std::string & path, + Chuck_CompileTarget * importer ) +{ + // ignore if not importing + if( !importer ) return NULL; + + // return value + Chuck_CompileTarget * ret = NULL; + // search path + std::string key = expand_filepath( path ); + + // log + EM_log( CK_LOG_FINER, "@import registery search: '%s' ", path.c_str() ); + + // if importer is a file + if( importer->filename != CHUCK_CODE_LITERAL_SIGNIFIER ) + { + // transplant to absolute path, resolves to realpath + key = transplant_filepath( importer->absolutePath, key ); + } + else // if not, importer is code + { + // if not an absolute path + if( !is_absolute_path( key ) ) + { + // use the current working directory + key = importer->the_chuck->getParamString( CHUCK_PARAM_WORKING_DIRECTORY ) + path; + } + } + + // push log + EM_pushlog(); + + // attempt to find in done list + map::iterator it = m_done.find( key ); + // if not found + if( it != m_done.end() ) + { + ret = it->second; + // log (if import only) + EM_log( CK_LOG_FINER, "found (compiled): '%s'", key.c_str() ); + } + + // if not found + if( !ret ) + { + // attempt to find in in-progress list + it = m_inProgress.find( key ); + // if not found + if( it != m_inProgress.end() ) + { + ret = it->second; + // log + EM_log( CK_LOG_FINER, "found (in-progress): '%s'", key.c_str() ); + } + } + + // if still not found + if( !ret ) + { EM_log( CK_LOG_FINER, "(not found)" ); } + + // pop log (if import only) + EM_poplog(); + + // return findings + return ret; +} + + + + +//----------------------------------------------------------------------------- +// name: addTarget() +// desc: add a new compile target to import system +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_ImportRegistry::addInProgress( Chuck_CompileTarget * target ) +{ + // check + if( !target ) return FALSE; + + // cannot add if key already exists + if( m_inProgress.find( target->key() ) != m_inProgress.end() ) + { + // internal error; should have been verified before calling this function + EM_error2( 0, "(import registry) cannot add target to in-progress list..." ); + EM_error2( 0, " |- '%s' already present...", target->key().c_str() ); + return FALSE; + } + + // insert + m_inProgress[target->key()] = target; + // return + return TRUE; +} + + + + +//----------------------------------------------------------------------------- +// name: markComplete() +// desc: mark a target as complete +//----------------------------------------------------------------------------- +void Chuck_ImportRegistry::markComplete( Chuck_CompileTarget * target ) +{ + // check + if( !target ) return; + + // set state to COMPLETE + target->state = te_compile_complete; + // get key + string key = target->key(); + + // remove from in-progress list + m_inProgress.erase( key ); + + // check if in map + if( m_done.find( key ) != m_done.end() ) + { + // warn + EM_log( CK_LOG_WARNING, "import registry duplicate complete target: '%s'", key.c_str() ); + } + + // should be safe to cleanup AST and close any file handles + target->cleanup(); + + // insert into done map + m_done[key] = target; +} + + + + +//----------------------------------------------------------------------------- +// name: clearInProgress() +// desc: remove in-progress targets +//----------------------------------------------------------------------------- +void Chuck_ImportRegistry::clearInProgress() +{ + // iterator + map::iterator it; + // iterate + for( it = m_inProgress.begin(); it != m_inProgress.end(); it++ ) + { + // delete the target + CK_SAFE_DELETE( it->second ); + } + // clear map + m_inProgress.clear(); +} + + + + +//----------------------------------------------------------------------------- +// name: clearAll() +// desc: remove all targets +//----------------------------------------------------------------------------- +void Chuck_ImportRegistry::clearAll() +{ + // clear maps + m_done.clear(); + m_inProgress.clear(); +} + + + + +//----------------------------------------------------------------------------- +// name: cleanupAST() +// desc: clean up abstract syntax tree in target +//----------------------------------------------------------------------------- +void Chuck_CompileTarget::cleanupAST() +{ + // clean up abstract syntax tree + if( AST ) + { + // delete tree + delete_program( AST ); + // null out + AST = NULL; + } +} + + + + +//----------------------------------------------------------------------------- +// name: cleanup() +// desc: performs cleanup (e.g., close file descriptors and reclaims AST) +// prepares target to be archived in import system after successful compilation +//----------------------------------------------------------------------------- +void Chuck_CompileTarget::cleanup() +{ + // clean up abstract syntax tree + cleanupAST(); + + // clean up the file source + fileSource.reset(); + + // if open + if( fd2parse ) + { + // close file descriptor + fclose( fd2parse ); + // null out + fd2parse = NULL; + } + + // free the intList + IntList curr = NULL; + while( the_linePos ) + { + curr = the_linePos; + the_linePos = the_linePos->rest; + // free + free( curr ); + } + // make new intList + the_linePos = intList( 0, NULL ); + + // reset line number + lineNum = 1; +} + + + + +//----------------------------------------------------------------------------- +// name: resolveFilename() +// desc: resolve and set filename and absolutePath for a compile target +// * set as filename (possibly with modifications, e.g., with .ck appended) +// * if file is unresolved locally and `expandSearchToGlobal` is true, +// expand search to global search paths +// * the file is resolved this will open a FILE descriptor in fd2parse +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_CompileTarget::resolveFilename( const std::string & theFilename, + Chuck_CompileTarget * importer, + t_CKBOOL expandSearchToGlobal, + t_CKINT wherePos ) +{ + // clean up + cleanup(); + + // reset fields (in case of error) + this->filename = ""; + this->absolutePath = ""; + this->codeLiteral = ""; + + // expand and trim + string fname = expand_filepath(trim(theFilename)); + // if this is part of an @import + if( importer != NULL ) + { + // if the importer is a file + if( importer->filename != CHUCK_CODE_LITERAL_SIGNIFIER ) + { + // transplant filename + fname = transplant_filepath( importer->absolutePath, fname ); + } + else // otherwise, importer is code + { + // use current working directory + fname = importer->the_chuck->getParamString( CHUCK_PARAM_WORKING_DIRECTORY ) + fname; + } + } + // set filename tentatively + this->filename = fname; + + // open, could potentially change filename + fd2parse = ck_openFileAutoExt( filename, ".ck" ); + // check file open result + if( !fd2parse ) // if couldn't open + { + // revert filename + filename = fname; + } + else if( ck_isdir( filename ) ) // check for directory + { + // print error + EM_error2( wherePos, "cannot parse file: '%s' is a directory", mini( filename.c_str() ) ); + // done + return FALSE; + } + + // if unresolved + if( !fd2parse && expandSearchToGlobal ) + { + // TODO + } + + // if still unresolved + if( !fd2parse ) + { + // print error + EM_error2( wherePos, "no such file: '%s'", mini( filename.c_str() ) ); + // done + return FALSE; + } + + // set file descriptor to beginning + fseek( fd2parse, 0, SEEK_SET ); + + // construct full path so me.sourceDir() works | 1.3.3.0 + this->absolutePath = get_full_path( filename ); + // shorthand name + this->filename = mini( filename.c_str() ); + + // done + return TRUE; +} diff --git a/src/core/chuck_compile.h b/src/core/chuck_compile.h index 6403848db..f94c7da72 100644 --- a/src/core/chuck_compile.h +++ b/src/core/chuck_compile.h @@ -27,7 +27,10 @@ // desc: chuck compile system unifying parser, type checker, and emitter // // author: Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu) -// date: Autumn 2005 - original +// date: Autumn 2005 - original +// Autumn 2017 - major refactor (with Jack Atherton) +// Summer 2023 - major update to error reporting +// Autumn 2024 - import system (with Nick Shaheed) //----------------------------------------------------------------------------- #ifndef __CHUCK_COMPILE_H__ #define __CHUCK_COMPILE_H__ @@ -39,10 +42,189 @@ #include "chuck_emit.h" #include "chuck_vm.h" #include +#include + + +//----------------------------------------------------------------------------- // forward reference +//----------------------------------------------------------------------------- struct Chuck_DLL; +struct Chuck_CompileTarget; + + + + +//----------------------------------------------------------------------------- +// compilation state, e.g., for compile targets +//----------------------------------------------------------------------------- +enum te_CompileState +{ + te_compile_inprogress, + te_compile_complete +}; + + + + +//----------------------------------------------------------------------------- +// name: intList +// desc: a linked list of token positions by line | moved from errmsg +//----------------------------------------------------------------------------- +typedef struct intList { t_CKINT i; struct intList *rest; } *IntList; +// constructor +static IntList intList( t_CKINT i, IntList rest ) +{ + IntList l = (IntList)checked_malloc(sizeof *l); + l->i=i; l->rest=rest; + return l; +} + + + + +//----------------------------------------------------------------------------- +// name: struct ImportTargetNode +// desc: a specific import node, corresponding to a particular @import +//----------------------------------------------------------------------------- +struct ImportTargetNode +{ + Chuck_CompileTarget * target; // actual target + t_CKINT where; // pos + t_CKINT line; // line + + ImportTargetNode( Chuck_CompileTarget * t = NULL, t_CKINT wh = 0, t_CKINT ln = 0 ) + : target( t ), where( wh ), line( ln ) { } +}; + + + + +//----------------------------------------------------------------------------- +// name: struct Chuck_CompileTarget +// desc: an compilation target +//----------------------------------------------------------------------------- +struct Chuck_CompileTarget +{ +public: + // constructor + Chuck_CompileTarget( te_HowMuch extent = te_do_all ) + : state(te_compile_inprogress), + howMuch(extent), timestamp(0), fd2parse(NULL), + lineNum(1), tokPos(0), AST(NULL), + the_chuck(NULL) + { + // initialize + the_linePos = intList( 0, NULL ); + } + + // destructor + virtual ~Chuck_CompileTarget() + { cleanup(); CK_SAFE_FREE( the_linePos ); } + + // performs cleanup (e.g., close file desriptors and reclaims AST) + // post-parser prep for target to be archived in registry + void cleanup(); + // clean up AST + void cleanupAST(); + +public: + // resolve and set filename and absolutePath for a compile target + // * set as filename (possibly with modifications, e.g., with .ck appended) + // * if `importer` is non-empty, will use it as the base of the filename (unless filename is already an absolute path) + // * if file is unresolved locally and `expandSearchToGlobal` is true, expand search to global search paths + // * the file is resolved this will open a FILE descriptor in fd2parse + // * wherePos can be provided to indiciate parser position in containing file (e.g., @import) + t_CKBOOL resolveFilename( const std::string & theFilename, + Chuck_CompileTarget * importer, + t_CKBOOL expandSearchToGlobal, + t_CKINT wherePos = 0 ); + // get filename + std::string getFilename() const { return filename; } + // set absolute path + void setAbsolutePath( const std::string & fullpath ) { absolutePath = fullpath; } + // get absolute path + std::string getAbsolutePath() const { return absolutePath; } + // hash key + std::string key() const { return absolutePath; } + +public: + // filename for reading from file + std::string filename; + // this should be unique; also key for import hash + std::string absolutePath; + +public: + // state + te_CompileState state; + // all or import-only or no-import + te_HowMuch howMuch; + // code literal (alternative to reading from file) + std::string codeLiteral; + + // line number (should be at end of file; used for error reporting) + t_CKINT lineNum; + // token position (used for error reporting) + t_CKINT tokPos; + // file descriptor to parse + FILE * fd2parse; + // file source info (for better error reporting) + CompileFileSource fileSource; + // pointer to abstract syntax tree + a_Program AST; + // for the current file + IntList the_linePos; + + // targets this target depends on + std::vector dependencies; + // timestamp of target file when target was compiled + // used to detect and potentially warn of modified files + time_t timestamp; + + // reference to ChucK instance + ChucK * the_chuck; + +public: // ONLY USED for topology + t_CKBOOL mark; +}; + + + + +//----------------------------------------------------------------------------- +// name: struct Chuck_ImportRegistry +// desc: registry of import targets +//----------------------------------------------------------------------------- +struct Chuck_ImportRegistry +{ +public: + // constructor + Chuck_ImportRegistry(); + virtual ~Chuck_ImportRegistry() { clearAll(); } + +public: + // clear in-progress list + void clearInProgress(); + // clear all contents (in-progress and done); this is for when VM is cleared + void clearAll(); + +public: + // look up a compile target by path + Chuck_CompileTarget * lookup( const std::string & path, Chuck_CompileTarget * relativeTo = NULL ); + // add a compile target to in-progress list + t_CKBOOL addInProgress( Chuck_CompileTarget * target ); + // remove a compile target by path + t_CKBOOL remove( const std::string & path ); + // mark a target as complete + void markComplete( Chuck_CompileTarget * target ); + +protected: + // map of targets being compiled (not yet completed) + std::map m_inProgress; + // map of successfully compiled targets + std::map m_done; +}; @@ -64,6 +246,8 @@ struct Chuck_Compiler Chuck_VM * vm() const { return m_carrier->vm; } // REFACTOR-2017: get associated, per-compiler carrier Chuck_Carrier * carrier() const { return m_carrier; } + // get import registry | 1.5.3.5 (ge) + Chuck_ImportRegistry * imports() { return &m_importRegistry; } // set carrier t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; } @@ -73,6 +257,8 @@ struct Chuck_Compiler // generated code Chuck_VM_Code * code; + // import registry + Chuck_ImportRegistry m_importRegistry; // auto-depend flag t_CKBOOL m_auto_depend; // recent map @@ -106,27 +292,19 @@ struct Chuck_Compiler public: // compile // set auto depend void set_auto_depend( t_CKBOOL v ); - // parse, type-check, and emit a program - t_CKBOOL go( const std::string & filename, - const std::string & full_path = "", - const std::string & codeLiteral = "" ); + // parse, type-check, and emit a program from file + t_CKBOOL compileFile( const std::string & filename ); + // parse, type-check, and emit a program from code string + t_CKBOOL compileCode( const std::string & codeLiteral ); + // compile a target | 1.5.3.5 (ge) + // NOTE: this function will memory-manage `target` + // (do not access or delete `target` afterwards) + t_CKBOOL compile( Chuck_CompileTarget * target ); // resolve a type automatically, if auto_depend is on t_CKBOOL resolve( const std::string & type ); - // get the code generated from the last go() + // get the code generated from the last compile() Chuck_VM_Code * output( ); -public: // special FILE input mode | added 1.5.0.5 (ge) - // set an already open FILE descriptor `fd` for one time use - // by the next call to go(), which will use `fd` as the input - // to the parser (NOTE in any invocation of go(), `codeLiteral` - // and `fd` should not both be non-empty, otherwise a warning - // will be output and the `codeLiteral` will take precedence - // and the `fd` will be cleaned up and skipped - // MEMORY: if `autoClose` is true, the compiler will automatically - // call fclose() on `fd` on the next call to go(), regardless of - // the aforementioned conflict with `codeLiteral` - void set_file2parse( FILE * fd, t_CKBOOL autoClose ); - public: // replace-dac | added 1.4.1.0 (jack) // sets a "replacement dac": one global UGen is secretly used // as a stand-in for "dac" for this compilation; @@ -137,43 +315,66 @@ struct Chuck_Compiler void setReplaceDac( t_CKBOOL shouldReplaceDac, const std::string & replacement ); public: - // chugin load | 1.4.1.0 (ge) refactored - t_CKBOOL load_external_modules( const char * extension, + // .chug and .ck modules pre-load sequence | 1.4.1.0 (ge) refactored + t_CKBOOL load_external_modules( const std::string & extension, std::list & chugin_search_paths, std::list & named_dls, t_CKBOOL recursiveSearch ); + // load external modules in named directory + t_CKBOOL load_external_modules_in_directory( const std::string & directory, + const std::string & extension, + t_CKBOOL recursiveSearch ); + // load a chugin by path | 1.5.2.5 (ge) exposed API for more dynamic loading + t_CKBOOL load_external_chugin( const std::string & path, const std::string & name = "" ); + // load a ck module by file path | 1.5.2.5 (ge) exposed API for more dynamic loading + t_CKBOOL load_external_cklib( const std::string & path, const std::string & name = "" ); +public: // chugin probe | 1.5.0.4 (ge) added - static t_CKBOOL probe_external_modules( const char * extension, + static t_CKBOOL probe_external_modules( const std::string & extension, std::list & chugin_search_paths, std::list & named_dls, t_CKBOOL recursiveSearch, std::list & ck_libs ); + // probe all external modules by extension within a directory + static t_CKBOOL probe_external_modules_in_directory( const std::string & directory, + const std::string & extension, + t_CKBOOL recursiveSearch, + std::list & ck_libs ); + // probe external chugin by file path + static t_CKBOOL probe_external_chugin( const std::string & path, const std::string & name = "" ); protected: // internal - // do entire file - t_CKBOOL do_entire_file( Chuck_Context * context ); - // do just class definitions - t_CKBOOL do_only_classes( Chuck_Context * context ); - // do all excect classes - t_CKBOOL do_all_except_classes( Chuck_Context * context ); - // do normal compile - t_CKBOOL do_normal_depend( const std::string & path, - const std::string & codeLiteral = "", - const std::string & full_path = "" ); - // do auto-depend compile - t_CKBOOL do_auto_depend( const std::string & path, - const std::string & codeLiteral = "", - const std::string & full_path = "" ); - // look up in recent - Chuck_Context * find_recent_path( const std::string & path ); - // look up in recent - Chuck_Context * find_recent_type( const std::string & type ); - // add to recent - t_CKBOOL add_recent_path( const std::string & path, Chuck_Context * context ); + // compile a single target + t_CKBOOL compile_single( Chuck_CompileTarget * target ); + // compile entire file + t_CKBOOL compile_entire_file( Chuck_Context * context ); + // import only: public definitions (e.g., classes and operator overloads) + t_CKBOOL compile_import_only( Chuck_Context * context ); // 1.5.2.5 (ge) added + // all except import + t_CKBOOL compile_all_except_import( Chuck_Context * context ); + +public: // import + // scan for @import statements; builds a list of dependencies in the target + t_CKBOOL scan_imports( Chuck_CompileTarget * target ); + // scan for @import statements, and return a list of resulting import targets + t_CKBOOL scan_imports( Chuck_Env * env, Chuck_CompileTarget * target, Chuck_ImportRegistry * registery ); + +protected: // internal import dependency helpers + // produce a compilation sequences of targets from a import dependency graph + static t_CKBOOL generate_compile_sequence( ImportTargetNode * head, + std::vector & sequence, + std::vector & problems ); + // visit + static t_CKBOOL visit( ImportTargetNode * node, + std::vector & sequence, + std::set & permanent, + std::set & temporary, + std::vector & problems ); }; + #endif diff --git a/src/core/chuck_emit.cpp b/src/core/chuck_emit.cpp index eb74b6619..725553f91 100644 --- a/src/core/chuck_emit.cpp +++ b/src/core/chuck_emit.cpp @@ -212,21 +212,21 @@ Chuck_VM_Code * emit_engine_emit_prog( Chuck_Emitter * emit, a_Program prog, { case ae_section_stmt: // code section // if only classes, then skip - if( how_much == te_do_classes_only ) break; + if( how_much == te_do_import_only ) break; // emit statement list ret = emit_engine_emit_stmt_list( emit, prog->section->stmt_list ); break; case ae_section_func: // function definition - // if only classes, then skip - if( how_much == te_do_classes_only ) break; + // check the compilation criteria | 1.5.2.5 (ge) added + if( !howMuch_criteria_match( how_much, prog->section->func_def ) ) break; // check function definition ret = emit_engine_emit_func_def( emit, prog->section->func_def ); break; case ae_section_class: // class definition - // if no classes, then skip - if( how_much == te_do_no_classes ) break; + // check the compilation criteria | 1.5.2.5 (ge) added + if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break; // check class definition ret = emit_engine_emit_class_def( emit, prog->section->class_def ); break; @@ -553,6 +553,11 @@ t_CKBOOL emit_engine_emit_stmt( Chuck_Emitter * emit, a_Stmt stmt, t_CKBOOL pop break; } + case ae_stmt_import: // 1.5.2.5 (ge) added + // do nothing here (return true to bypass) + ret = TRUE; + break; + case ae_stmt_if: // if statement ret = emit_engine_emit_if( emit, &stmt->stmt_if ); codestr_close = "} /** " + codestr + " **/"; diff --git a/src/core/chuck_emit.h b/src/core/chuck_emit.h index 478526f73..c8bb11ab7 100644 --- a/src/core/chuck_emit.h +++ b/src/core/chuck_emit.h @@ -194,7 +194,7 @@ t_CKBOOL emit_engine_shutdown( Chuck_Emitter *& emit ); // emit a program into vm code Chuck_VM_Code * emit_engine_emit_prog( Chuck_Emitter * emit, a_Program prog, - te_HowMuch how_much = te_do_all ); + te_HowMuch how_much ); // helper function to emit code Chuck_VM_Code * emit_to_code( Chuck_Code * in, Chuck_VM_Code * out = NULL, diff --git a/src/core/chuck_errmsg.cpp b/src/core/chuck_errmsg.cpp index c0655380f..02570f612 100644 --- a/src/core/chuck_errmsg.cpp +++ b/src/core/chuck_errmsg.cpp @@ -54,10 +54,15 @@ using namespace std; t_CKINT EM_tokPos = 0; t_CKINT EM_lineNum = 1; +// current per-file error message context | 1.5.3.5 (ge) +static Chuck_CompileTarget * the_compileTarget = NULL; // current filename static const char * the_filename = ""; -// current chuck -static ChucK * the_chuck = NULL; + +// file source info (for better error reporting) | 1.5.0.5 (ge) +// static CompileFileSource g_currentFile; +// whether to highlight | 1.5.0.5 (ge) +static t_CKBOOL g_highlight_on_error = TRUE; // a local global string buffer for snprintf #define CK_ERR_BUF_LENGTH 2048 @@ -88,11 +93,6 @@ static char g_buffer2[g_buffer2_size] = ""; void (*g_stdout_callback)(const char *) = NULL; void (*g_stderr_callback)(const char *) = NULL; -// file info | 1.5.0.5 (ge) -static CompileFileSource g_currentFile; -// whether to highlight -static t_CKBOOL g_highlight_on_error = TRUE; - // name static const char * g_str[] = { "NONE", // 0 @@ -111,33 +111,6 @@ static const char * g_str[] = { -//----------------------------------------------------------------------------- -// name: EM_set_current_chuck() -// set current ChucK; used to query current params -//----------------------------------------------------------------------------- -void EM_set_current_chuck( ChucK * ck ) -{ - // set as current chuck - the_chuck = ck; -} - - - - -//----------------------------------------------------------------------------- -// name: intList -// desc: a linked list of token positions by line -//----------------------------------------------------------------------------- -typedef struct intList { t_CKINT i; struct intList *rest; } *IntList; -// for the current file -static IntList the_linePos = NULL; -// constructor -static IntList intList( t_CKINT i, IntList rest ) -{ - IntList l = (IntList)checked_malloc(sizeof *l); - l->i=i; l->rest=rest; - return l; -} //----------------------------------------------------------------------------- // called by lexer on new line // 1.5.0.5 (ge) updated to take a pos argument @@ -154,18 +127,18 @@ void EM_newline( t_CKINT pos, t_CKINT lineNum ) if( diff < 1 ) { // increment line num - EM_lineNum++; + EM_lineNum++; the_compileTarget->lineNum++; // add to linked list - the_linePos = intList( pos, the_linePos ); + the_compileTarget->the_linePos = intList( pos, the_compileTarget->the_linePos ); } else // diff == 1 (another line of code) or... // diff > 1 (multi-line string literal, does not call EM_newline until the end) { // create nodes for one or more lines for( int i = EM_lineNum; i < lineNum; i++ ) - the_linePos = intList( pos, the_linePos ); + the_compileTarget->the_linePos = intList( pos, the_compileTarget->the_linePos ); // set to new line num - EM_lineNum = lineNum; + EM_lineNum = the_compileTarget->lineNum = lineNum; } } @@ -233,10 +206,10 @@ void EM_reset_msg() t_CKBOOL EM_highlight_on_error() { // if we have a chuck reference - if( the_chuck ) + if( the_compileTarget && the_compileTarget->the_chuck ) { // update - g_highlight_on_error = the_chuck->getParamInt( CHUCK_PARAM_COMPILER_HIGHLIGHT_ON_ERROR ); + g_highlight_on_error = the_compileTarget->the_chuck->getParamInt( CHUCK_PARAM_COMPILER_HIGHLIGHT_ON_ERROR ); } // return @@ -252,6 +225,9 @@ t_CKBOOL EM_highlight_on_error() //----------------------------------------------------------------------------- const char * EM_outputLineInCode( t_CKINT lineNumber, t_CKINT charNumber ) { + // check + if( the_compileTarget == NULL ) return ""; + // clear g_codestr = ""; @@ -259,7 +235,7 @@ const char * EM_outputLineInCode( t_CKINT lineNumber, t_CKINT charNumber ) if( !EM_highlight_on_error() || lineNumber <= 0 ) return ""; // get error line - std::string line = g_currentFile.getLine(lineNumber); + std::string line = the_compileTarget->fileSource.getLine(lineNumber); // detect empty file if( lineNumber == 1 && trim(line) == "" ) @@ -296,10 +272,10 @@ const char * EM_outputLineInCode( t_CKINT lineNumber, t_CKINT charNumber ) // base defaults WIDTH = 80; CARET_POS = 28; // check if update - if( the_chuck ) + if( the_compileTarget && the_compileTarget->the_chuck ) { // get params stored in chuck; could have been set from host - WIDTH = the_chuck->getParamInt( CHUCK_PARAM_TTY_WIDTH_HINT ); + WIDTH = the_compileTarget->the_chuck->getParamInt( CHUCK_PARAM_TTY_WIDTH_HINT ); CARET_POS = (t_CKUINT)(WIDTH/3.0); } } @@ -439,8 +415,8 @@ static void EM_error_prefix_end( t_CKBOOL colorTTY = TRUE, t_CKBOOL bold = FALSE void EM_error( t_CKINT pos, const char * message, ... ) { va_list ap; - IntList lines = the_linePos; - t_CKINT line = EM_lineNum; + IntList lines = pos ? the_compileTarget->the_linePos : NULL; + t_CKINT line = pos ? the_compileTarget->lineNum : 0; t_CKINT actualPos = -1; t_CKBOOL bold = TRUE; // declare each time to pick up any TC state @@ -505,8 +481,8 @@ void EM_error( t_CKINT pos, const char * message, ... ) void EM_error2( t_CKINT pos, const char * message, ... ) { va_list ap; - IntList lines = the_linePos; - t_CKINT line = EM_lineNum; + IntList lines = pos ? the_compileTarget->the_linePos : NULL; + t_CKINT line = pos ? the_compileTarget->lineNum : 0; t_CKINT actualPos = -1; t_CKBOOL bold = TRUE; // declare each time to pick up any TC state @@ -629,8 +605,8 @@ void EM_error2b( t_CKINT line, const char * message, ... ) const char * EM_error2str( t_CKINT pos, t_CKBOOL outputPrefix, const char * message, ... ) { va_list ap; - IntList lines = the_linePos; - t_CKINT line = EM_lineNum; + IntList lines = pos ? the_compileTarget->the_linePos : NULL; + t_CKINT line = pos ? the_compileTarget->lineNum : 0; t_CKINT actualPos = -1; t_CKBOOL bold = TRUE; // declare each time to pick up any TC state @@ -947,6 +923,8 @@ void EM_log_opts( t_CKINT level, enum em_LogOpts options, const char * message, t_CKBOOL prefix = !(options & EM_LOG_NO_PREFIX); // whether to print newline at end t_CKBOOL nl = !(options & EM_LOG_NO_NEWLINE); + // whether to indent + t_CKBOOL indent = !(options & EM_LOG_NO_INDENT); #ifndef __DISABLE_THREADS__ g_logmutex.acquire(); @@ -963,8 +941,8 @@ void EM_log_opts( t_CKINT level, enum em_LogOpts options, const char * message, TC::on(); // if( g_logstack ) CK_FPRINTF_STDERR( " " ); - for( int i = 0; i < g_logstack; i++ ) - CK_FPRINTF_STDERR( " | " ); + if( indent ) + { for( int i = 0; i < g_logstack; i++ ) CK_FPRINTF_STDERR( " | " ); } } va_start( ap, message ); @@ -1035,19 +1013,6 @@ void EM_start_filename( const char * fname ) { the_filename = fname ? fname : (c_str)""; EM_lineNum = 1; - - // free the intList - IntList curr = NULL; - while( the_linePos ) - { - curr = the_linePos; - the_linePos = the_linePos->rest; - // free - free( curr ); - } - - // make new intList - the_linePos = intList( 0, NULL ); } @@ -1080,6 +1045,33 @@ const char * EM_lasterror() +//----------------------------------------------------------------------------- +// name: EM_setCurrentTarget() +// desc: set current compile compilation target | 1.5.3.5 (ge) +//----------------------------------------------------------------------------- +void EM_setCurrentTarget( Chuck_CompileTarget * target ) +{ + // set + the_compileTarget = target; + + // if target + if( target != NULL ) + { + // load in the information + EM_lineNum = target->lineNum; + the_filename = target->filename.c_str(); + } + else + { + // reset + EM_lineNum = 0; + the_filename = (c_str)""; + } +} + + + + //----------------------------------------------------------------------------- // name: EM_setCurrentFileSource() // desc: set where current file being compile comes from; used for highlighting @@ -1087,8 +1079,10 @@ const char * EM_lasterror() //----------------------------------------------------------------------------- void EM_setCurrentFileSource( const CompileFileSource & source ) { + // check (ignore if NULL) + if( the_compileTarget == NULL ) return; // set - g_currentFile = source; + the_compileTarget->fileSource = source; } @@ -1100,7 +1094,10 @@ void EM_setCurrentFileSource( const CompileFileSource & source ) //----------------------------------------------------------------------------- void EM_cleanupCurrentFileSource() { - g_currentFile.reset(); + // check + if( the_compileTarget == NULL ) return; + // reset + the_compileTarget->fileSource.reset(); } diff --git a/src/core/chuck_errmsg.h b/src/core/chuck_errmsg.h index 1efaa45fc..d8664a9a6 100644 --- a/src/core/chuck_errmsg.h +++ b/src/core/chuck_errmsg.h @@ -57,7 +57,8 @@ enum em_LogOpts { EM_LOG_NONE = 0, EM_LOG_NO_NEWLINE = 0x1, - EM_LOG_NO_PREFIX = 0x10 + EM_LOG_NO_PREFIX = 0x10, + EM_LOG_NO_INDENT = 0x100 }; // C linkage @@ -178,11 +179,13 @@ extern "C++" { #include -// forward reference | 1.5.0.5 (ge) added +// class forward reference | 1.5.0.5 (ge) added class ChucK; +// struct forward reference | 1.5.3.5 (ge) added +struct Chuck_CompileTarget; -// set current ChucK; used to query params | 1.5.0.5 -void EM_set_current_chuck( ChucK * ck ); +// set current compile compilation target; used for state | 1.5.3.5 (ge) +void EM_setCurrentTarget( Chuck_CompileTarget * target ); @@ -293,6 +296,8 @@ void EM_setCurrentFileSource( const CompileFileSource & info ); void EM_cleanupCurrentFileSource(); + + //----------------------------------------------------------------------------- // name: class SmartPushLog (added 1.4.1.0 spencer) // desc: scoped EM_pushlog for convenience and auto-balancing of push/pop logs diff --git a/src/core/chuck_otf.cpp b/src/core/chuck_otf.cpp index 30d33b938..bb2aeb360 100644 --- a/src/core/chuck_otf.cpp +++ b/src/core/chuck_otf.cpp @@ -212,10 +212,16 @@ t_CKUINT otf_process_msg( Chuck_VM * vm, Chuck_Compiler * compiler, // (added 1.3.5.2) std::string full_path = get_full_path( msg->buffer ); - // special FILE descriptor mode; set autoClose to FALSE ('cleanup' will close fd) - compiler->set_file2parse( fd, FALSE ); - // parse, type-check, and emit - if( !compiler->go( msg->buffer, full_path ) ) + // construct a target to be compiled | 1.5.3.5 (ge) + Chuck_CompileTarget * target = new Chuck_CompileTarget(); + // set file descriptor + target->fd2parse = fd; + // set fields + target->filename = msg->buffer; + target->absolutePath = full_path; + + // parse, type-check, and emit; compiler will memory-manage target (no need to delete here) + if( !compiler->compile( target ) ) { CK_SAFE_DELETE(cmd); goto cleanup; @@ -333,19 +339,28 @@ t_CKINT otf_send_file( const char * fname, OTF_Net_Msg & msg, const char * op, return FALSE; } + // make a target + Chuck_CompileTarget * target = new Chuck_CompileTarget(); + target->fd2parse = fd; + target->filename = filename; + // check to see if at least parses - if( !chuck_parse( filename ) ) + if( !chuck_parse( target ) ) { // error message EM_error2( 0, "(parse error) skipping file '%s' for [%s]...", filename.c_str(), op ); - // reset parser (clean up) | 1.5.1.5 - reset_parse(); // close file descriptor fclose( fd ); + // reset parser (clean up) | 1.5.1.5 + reset_parse(); + // clean up target + CK_SAFE_DELETE( target ); return FALSE; } // reset parser (clean up) | 1.5.1.5 reset_parse(); + // clean up target + CK_SAFE_DELETE( target ); // stat it memset( &fs, 0, sizeof(fs) ); diff --git a/src/core/chuck_parse.cpp b/src/core/chuck_parse.cpp index 7d615e741..1b3d0d36d 100644 --- a/src/core/chuck_parse.cpp +++ b/src/core/chuck_parse.cpp @@ -32,6 +32,7 @@ //----------------------------------------------------------------------------- #include "chuck_parse.h" #include "chuck_errmsg.h" +#include "chuck_compile.h" #include "util_string.h" #include "util_platforms.h" @@ -44,18 +45,12 @@ #include using namespace std; -// global -static std::string g_filename; -// file to parse -static FILE * g_fd2parse = NULL; -// whether to auto close -static t_CKBOOL g_fd2autoClose = FALSE; -// separate file to close -static FILE * g_fd2close = NULL; -// clean up function -static void fd2parse_cleanup(); + + +//----------------------------------------------------------------------------- // external from lexer +//----------------------------------------------------------------------------- extern "C" { extern FILE * yyin; } @@ -88,60 +83,42 @@ static void cleanup_AST() // desc: INPUT: chuck code (either from file or actual code) to be parsed // OUTPUT: abstract syntax tree representation of the code //----------------------------------------------------------------------------- -t_CKBOOL chuck_parse( const std::string & fname, const std::string & codeLiteral ) +t_CKBOOL chuck_parse( Chuck_CompileTarget * target ) { // return value t_CKBOOL ret = FALSE; - // file descriptor | normally NULL unless g_fd2parse is set - FILE * fd = g_fd2parse; + // file descriptor (should be open if compiling from file) + FILE * fd = target->fd2parse; // our own lexer/parser buffer YY_BUFFER_STATE yyCodeBuffer = NULL; // where the code is coming from CompileFileSource source; // check for conflict - if( fd && codeLiteral != "" ) + if( fd && target->codeLiteral != "" ) { CK_FPRINTF_STDERR( "[chuck](parser): (internal) code and FILE descriptor both present!\n" ); CK_FPRINTF_STDERR( "[chuck](parser): |- ignoring FILE descriptor...\n" ); } - // copy it - g_filename = fname; - // if actual code was passed in - if( codeLiteral != "" ) + if( target->codeLiteral != "" ) { // clean lexer yyrestart( NULL ); // set to initial condition | 1.5.2.4 (ge) added yyinitial(); // load string (yy_scan_string will copy the C string) - yyCodeBuffer = yy_scan_string( codeLiteral.c_str() ); - // if could load + yyCodeBuffer = yy_scan_string( target->codeLiteral.c_str() ); + // if could not load if( !yyCodeBuffer ) goto cleanup; // set source - source.setCode( codeLiteral.c_str() ); + source.setCode( target->codeLiteral.c_str() ); } - else + else if( fd != NULL ) { - // test it - if( !fd ) - { - // open, could potentially change g_filename - fd = ck_openFileAutoExt( g_filename, ".ck" ); - // check file open result - if( !fd ) // if couldn't open - { g_filename = fname; } // revert filename - else if( ck_isdir(g_filename) ) // check for directory; if so, clean up - { EM_error2( 0, "cannot parse file: '%s' is a directory", mini(g_filename.c_str()) ); goto cleanup; } - } - - // if still none - if( !fd ) { EM_error2( 0, "no such file: '%s'", mini(fname.c_str()) ); goto cleanup; } - // set to beginning0 - else fseek( fd, 0, SEEK_SET ); - + // set to beginning + fseek( fd, 0, SEEK_SET ); // reset yyin to fd yyrestart( fd ); // set to initial condition | 1.5.0.5 (ge) added @@ -153,14 +130,20 @@ t_CKBOOL chuck_parse( const std::string & fname, const std::string & codeLiteral // set source source.setFile( fd ); } + else + { + CK_FPRINTF_STDERR( "[chuck](parser): (internal) code and FILE descriptor both NULL!\n" ); + CK_FPRINTF_STDERR( "[chuck](parser): |- bailing out...\n" ); + return FALSE; + } // start error message for new filename - EM_start_filename( g_filename.c_str() ); + EM_start_filename( target->filename.c_str() ); // set current input source EM_setCurrentFileSource( source ); // ensure abstract syntax tree is clean | 1.5.0.5 (ge) added, finally - cleanup_AST(); + target->cleanupAST(); // parse if( !(yyparse() == 0) ) goto cleanup; @@ -170,10 +153,6 @@ t_CKBOOL chuck_parse( const std::string & fname, const std::string & codeLiteral cleanup: - // defer some clean up to reset_parse(), since later passes - // could use current file source / file descriptor; copy - g_fd2close = fd; - // flush // yyflush(); @@ -190,80 +169,16 @@ t_CKBOOL chuck_parse( const std::string & fname, const std::string & codeLiteral -//------------------------------------------------------------------------------ -// name: fd2parse_cleanup() -// desc: clean up fd2parse -//------------------------------------------------------------------------------ -void fd2parse_cleanup() -{ - // check - if( g_fd2parse && g_fd2autoClose ) - { - // log - EM_log( CK_LOG_FINEST, "fd2parse_clean() closing FILE descriptor [0x%x]...", (t_CKUINT)g_fd2parse ); - fclose( g_fd2parse ); - } - - // reset - g_fd2parse = NULL; - g_fd2autoClose = FALSE; -} - - - - -//------------------------------------------------------------------------------ -// name: fd2parse_set() -// desc: special FILE input mode | added 1.5.0.5 (ge) -// set an already open FILE descriptor `fd` for one time use -// by the next call to go(), which will use `fd` as the input -// to the parser (NOTE in any invocation of go(), `codeLiteral` -// and `fd` should not both be non-empty, otherwise a warning -// will be output and the `codeLiteral` will take precedence -// and the `fd` will be cleaned up and skipped -// MEMORY: if `autoClose` is true, the compiler will automatically -// call fclose() on `fd` on the next call to go(), regardless of -// the aforementioned conflict with `codeLiteral` -//------------------------------------------------------------------------------ -void fd2parse_set( FILE * fd, t_CKBOOL autoClose ) -{ - // clean up - fd2parse_cleanup(); - - // copy - g_fd2parse = fd; - g_fd2autoClose = autoClose; -} - - - - //------------------------------------------------------------------------------ // name: reset_parse() // desc: reset parse after a parse //------------------------------------------------------------------------------ void reset_parse( ) { - // reset the current input source - EM_cleanupCurrentFileSource(); - - // clean up the file descriptor - if( g_fd2close ) - { - // check fd2parse (could be the same) - if( g_fd2parse ) { fd2parse_cleanup(); } - else { fclose( g_fd2close ); } - // zero out either way - g_fd2close = NULL; - } - // empty file name EM_reset_filename(); - // clear current ChucK pointer; no dangling references - EM_set_current_chuck( NULL ); - - // clean up the AST - cleanup_AST(); + // unset target + EM_setCurrentTarget( NULL ); } diff --git a/src/core/chuck_parse.h b/src/core/chuck_parse.h index 9076ab1ab..8e25f0e1a 100644 --- a/src/core/chuck_parse.h +++ b/src/core/chuck_parse.h @@ -58,14 +58,12 @@ typedef yy_buffer_state * YY_BUFFER_STATE; extern "C" YY_BUFFER_STATE yy_scan_string( const char * ); extern "C" void yy_delete_buffer( YY_BUFFER_STATE ); - -// parse ck file into abstract syntax tree (root at 'a_Program g_program') -t_CKBOOL chuck_parse( const std::string & filename, const std::string & code = "" ); +// forward reference +struct Chuck_CompileTarget; +// parse ck file into abstract syntax tree +t_CKBOOL chuck_parse( Chuck_CompileTarget * target ); // reset the parser void reset_parse(); -// set an open FILE descriptor to be parsed ONLY by the next call to chuck_parse() -// `fd` will be closed using fclose(), if autoClose is set to true -void fd2parse_set( FILE * fd, t_CKBOOL autoClose ); // convert abstract syntax stmt to string std::string absyn2str( a_Stmt stmt ); diff --git a/src/core/chuck_scan.cpp b/src/core/chuck_scan.cpp index 3c257ba6b..8e76c0613 100644 --- a/src/core/chuck_scan.cpp +++ b/src/core/chuck_scan.cpp @@ -160,8 +160,8 @@ t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog, break; case ae_section_class: - // if no classes, then skip - if( how_much == te_do_no_classes ) break; + // check the compilation criteria | 1.5.2.5 (ge) added + if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break; // make global, if marked public if( prog->section->class_def->decl == ae_key_public ) { @@ -185,7 +185,8 @@ t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog, default: EM_error2( prog->where, - "(internal error) unrecognized program section in type checker pre-scan..." ); + "(internal error) unrecognized program section (%d) in type checker pre-scan (0)...", + prog->section->s_type ); ret = FALSE; break; } @@ -400,28 +401,28 @@ t_CKBOOL type_engine_scan1_prog( Chuck_Env * env, a_Program prog, { case ae_section_stmt: // if only classes, then skip - if( how_much == te_do_classes_only ) break; + if( how_much == te_do_import_only ) break; // scan the statements ret = type_engine_scan1_stmt_list( env, prog->section->stmt_list ); break; case ae_section_func: - // if only classes, then skip - if( how_much == te_do_classes_only ) break; + // check the compilation criteria | 1.5.2.5 (ge) + if( !howMuch_criteria_match( how_much, prog->section->func_def ) ) break; // scan the function definition ret = type_engine_scan1_func_def( env, prog->section->func_def ); break; case ae_section_class: - // if no classes, then skip - if( how_much == te_do_no_classes ) break; + // check the compilation criteria | 1.5.2.5 (ge) + if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break; // scan the class definition ret = type_engine_scan1_class_def( env, prog->section->class_def ); break; default: EM_error2( prog->where, - "(internal error) unrecognized program section in type checker pre-scan..." ); + "(internal error) unrecognized program section in type checker pre-scan (1)..." ); ret = FALSE; break; } @@ -494,6 +495,11 @@ t_CKBOOL type_engine_scan1_stmt( Chuck_Env * env, a_Stmt stmt ) // the type of stmt switch( stmt->s_type ) { + case ae_stmt_import: // 1.5.2.5 (ge) added + // do nothing here (return true to bypass) + ret = TRUE; + break; + case ae_stmt_if: // count scope to help determine class member env->class_scope++; @@ -1665,28 +1671,28 @@ t_CKBOOL type_engine_scan2_prog( Chuck_Env * env, a_Program prog, { case ae_section_stmt: // if classes only, then skip - if( how_much == te_do_classes_only ) break; + if( how_much == te_do_import_only ) break; // scan the statements ret = type_engine_scan2_stmt_list( env, prog->section->stmt_list ); break; case ae_section_func: - // if classes only, then skip - if( how_much == te_do_classes_only ) break; + // check the compilation criteria | 1.5.2.5 (ge) + if( !howMuch_criteria_match( how_much, prog->section->func_def ) ) break; // scan the function definition ret = type_engine_scan2_func_def( env, prog->section->func_def ); break; case ae_section_class: - // if no classes, then skip - if( how_much == te_do_no_classes ) break; + // check the compilation criteria | 1.5.2.5 (ge) + if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break; // scan the class definition ret = type_engine_scan2_class_def( env, prog->section->class_def ); break; default: EM_error2( prog->where, - "(internal error) unrecognized program section in type checker pre-scan..." ); + "(internal error) unrecognized program section in type checker pre-scan (2)..." ); ret = FALSE; break; } @@ -1741,6 +1747,11 @@ t_CKBOOL type_engine_scan2_stmt( Chuck_Env * env, a_Stmt stmt ) // the type of stmt switch( stmt->s_type ) { + case ae_stmt_import: // 1.5.2.5 (ge) added + // do nothing here (return true to bypass) + ret = TRUE; + break; + case ae_stmt_if: // count scope to help determine class member env->class_scope++; diff --git a/src/core/chuck_type.cpp b/src/core/chuck_type.cpp index 5e9fdcc40..2deb24b5c 100644 --- a/src/core/chuck_type.cpp +++ b/src/core/chuck_type.cpp @@ -832,7 +832,7 @@ Chuck_Context * type_engine_make_context( a_Program prog, const string & filenam //----------------------------------------------------------------------------- // name: type_engine_check_context() -// desc: ... +// desc: type check a context (a context is equivalent to a single .ck file) //----------------------------------------------------------------------------- t_CKBOOL type_engine_check_context( Chuck_Env * env, Chuck_Context * context, @@ -873,21 +873,21 @@ t_CKBOOL type_engine_check_context( Chuck_Env * env, { case ae_section_stmt: // if only classes, then skip - if( how_much == te_do_classes_only ) break; + if( how_much == te_do_import_only ) break; // check the statements ret = type_engine_check_stmt_list( env, prog->section->stmt_list ); break; case ae_section_func: - // if only classes, then skip - if( how_much == te_do_classes_only ) break; + // check the compilation criteria | 1.5.2.5 (ge) added + if( !howMuch_criteria_match( how_much, prog->section->func_def ) ) break; // check the function definition ret = type_engine_check_func_def( env, prog->section->func_def ); break; case ae_section_class: - // if no classes, then skip - if( how_much == te_do_no_classes ) break; + // check the compilation criteria | 1.5.2.5 (ge) added + if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break; // check the class definition ret = type_engine_check_class_def( env, prog->section->class_def ); break; @@ -1060,6 +1060,11 @@ t_CKBOOL type_engine_check_stmt( Chuck_Env * env, a_Stmt stmt ) // the type of stmt switch( stmt->s_type ) { + case ae_stmt_import: // 1.5.2.5 (ge) added + // do nothing here (return true to bypass) + ret = TRUE; + break; + case ae_stmt_if: // count scope to help determine class member env->class_scope++; @@ -8748,14 +8753,14 @@ t_CKBOOL type_engine_is_base_static( Chuck_Env * env, Chuck_Type * baseType ) -static const char * g_howmuch[] = { "ALL", "CLASSES_ONLY", "ALL_EXCEPT_CLASSES" }; +static const char * g_howmuch[] = { "ALL", "IMPORT_ONLY", "ALL_EXCEPT_IMPORT" }; //----------------------------------------------------------------------------- // name: howmuch2str() // desc: ... //----------------------------------------------------------------------------- const char * howmuch2str( te_HowMuch how_much ) { - if( how_much < 0 || how_much > te_do_no_classes ) return "[INVALID]"; + if( how_much < 0 || how_much > te_skip_import ) return "[INVALID]"; else return g_howmuch[how_much]; } @@ -11409,3 +11414,58 @@ t_CKBOOL Chuck_Type::do_cbs_on_instantiate( std::vector & // done return retval; } + + + + +//----------------------------------------------------------------------------- +// name: howMuch_criteria_match() +// desc: check if a func def meets "HowMuch" to compile criteria +//----------------------------------------------------------------------------- +t_CKBOOL howMuch_criteria_match( te_HowMuch criteria, a_Func_Def func_def ) +{ + switch( criteria ) + { + case te_do_all: + // categorically true + return TRUE; + case te_do_import_only: + // check if 1) func def is public and 2) is an operator overload + if( func_def->func_decl == ae_key_public && func_def->op2overload != ae_op_none ) return TRUE; + break; + case te_skip_import: + // pass if either not public or not an operator overload + if( func_def->func_decl != ae_key_public || func_def->op2overload == ae_op_none ) return TRUE; + break; + } + // catch all + return FALSE; +} + + + + +//----------------------------------------------------------------------------- +// name: howMuch_criteria_match() +// desc: check if a class def meets "HowMuch" to compile criteria +//----------------------------------------------------------------------------- +t_CKBOOL howMuch_criteria_match( te_HowMuch criteria, a_Class_Def class_def ) +{ + switch( criteria ) + { + case te_do_all: + // categorically true + return TRUE; + break; + case te_do_import_only: + // check if class is declared as public + if( class_def->decl == ae_key_public ) return TRUE; + break; + case te_skip_import: + // check if class is declared as public + if( class_def->decl != ae_key_public ) return TRUE; + break; + } + // catch all + return FALSE; +} diff --git a/src/core/chuck_type.h b/src/core/chuck_type.h index 458daa1a7..24fcdd427 100644 --- a/src/core/chuck_type.h +++ b/src/core/chuck_type.h @@ -75,12 +75,18 @@ typedef enum { te_globalTypeNone, //----------------------------------------------------------------------------- // name: enum te_HowMuch -// desc: how much to scan/type check +// desc: how much to scan/type check/emit //----------------------------------------------------------------------------- typedef enum { - te_do_all = 0, te_do_classes_only, te_do_no_classes + te_do_all = 0, + te_do_import_only, // attend only to things to be imported | 1.5.3.5 (ge) + te_skip_import, // do everything except things to be imported | 1.5.3.5 (ge) } te_HowMuch; +// function to if a function matches a particular criteria +t_CKBOOL howMuch_criteria_match( te_HowMuch criteria, a_Func_Def func_def ); +t_CKBOOL howMuch_criteria_match( te_HowMuch criteria, a_Class_Def class_def ); + @@ -366,13 +372,13 @@ struct Chuck_Context : public Chuck_VM_Object // error - means to free nspc too t_CKBOOL has_error; - // AST parse tree (does not persist past context unloading) + // AST (does not persist past context unloading) a_Program parse_tree; // AST public class def if any (does not persist past context unloading) a_Class_Def public_class_def; // progress - enum { P_NONE = 0, P_CLASSES_ONLY, P_ALL_DONE }; + enum { P_NONE = 0, P_IMPORTED, P_ALL_DONE }; // progress in scan / type check / emit t_CKUINT progress; diff --git a/src/core/chuck_yacc.c b/src/core/chuck_yacc.c index 4dd707c29..a52637908 100644 --- a/src/core/chuck_yacc.c +++ b/src/core/chuck_yacc.c @@ -182,7 +182,8 @@ UNGRUCK_LEFT = 371, AT_OP = 372, AT_CTOR = 373, - AT_DTOR = 374 + AT_DTOR = 374, + AT_IMPORT = 375 }; #endif /* Tokens. */ @@ -303,6 +304,7 @@ #define AT_OP 372 #define AT_CTOR 373 #define AT_DTOR 374 +#define AT_IMPORT 375 @@ -411,9 +413,10 @@ typedef union YYSTYPE a_Complex complex_exp; a_Polar polar_exp; a_Vec vec_exp; // ge: added 1.3.5.3 + a_Import import; // 1.5.2.5 (ge) added } /* Line 193 of yacc.c. */ -#line 417 "chuck.tab.c" +#line 420 "chuck.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -438,7 +441,7 @@ typedef struct YYLTYPE /* Line 216 of yacc.c. */ -#line 442 "chuck.tab.c" +#line 445 "chuck.tab.c" #ifdef short # undef short @@ -653,22 +656,22 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 123 +#define YYFINAL 128 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2242 +#define YYLAST 2349 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 120 +#define YYNTOKENS 121 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 59 +#define YYNNTS 62 /* YYNRULES -- Number of rules. */ -#define YYNRULES 258 +#define YYNRULES 264 /* YYNRULES -- Number of states. */ -#define YYNSTATES 435 +#define YYNSTATES 445 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 374 +#define YYMAXUTOK 375 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -713,7 +716,7 @@ static const yytype_uint8 yytranslate[] = 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119 + 115, 116, 117, 118, 119, 120 }; #if YYDEBUG @@ -727,148 +730,152 @@ static const yytype_uint16 yyprhs[] = 114, 121, 128, 134, 140, 147, 156, 164, 174, 184, 196, 208, 210, 212, 213, 215, 217, 219, 221, 223, 225, 226, 228, 231, 235, 240, 242, 244, 246, 249, - 252, 257, 259, 262, 264, 266, 268, 270, 272, 275, - 279, 282, 285, 291, 299, 305, 313, 320, 328, 336, - 342, 350, 356, 359, 363, 365, 368, 370, 374, 376, - 380, 382, 386, 390, 395, 400, 406, 409, 413, 415, - 418, 422, 426, 430, 433, 437, 439, 443, 445, 448, - 451, 455, 460, 465, 471, 475, 479, 483, 485, 487, - 489, 491, 493, 495, 497, 499, 501, 503, 505, 507, - 509, 511, 513, 515, 517, 519, 521, 523, 525, 527, - 533, 535, 539, 541, 545, 547, 551, 553, 557, 559, - 563, 565, 569, 573, 575, 579, 583, 587, 591, 593, - 597, 601, 603, 607, 611, 613, 617, 621, 625, 627, - 631, 633, 637, 639, 642, 645, 648, 651, 654, 657, - 661, 666, 672, 678, 685, 687, 689, 691, 693, 695, - 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, - 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, - 738, 740, 742, 744, 746, 748, 750, 752, 754, 756, - 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, - 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, - 800, 802, 805, 809, 814, 818, 821, 824, 826, 828, - 830, 832, 834, 836, 838, 840, 842, 846, 850 + 252, 257, 259, 262, 264, 266, 268, 270, 272, 274, + 277, 281, 284, 287, 293, 301, 307, 315, 322, 330, + 338, 344, 352, 358, 361, 365, 368, 373, 375, 379, + 381, 383, 386, 388, 392, 394, 398, 400, 404, 408, + 413, 418, 424, 427, 431, 433, 436, 440, 444, 448, + 451, 455, 457, 461, 463, 466, 469, 473, 478, 483, + 489, 493, 497, 501, 503, 505, 507, 509, 511, 513, + 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, + 535, 537, 539, 541, 543, 545, 551, 553, 557, 559, + 563, 565, 569, 571, 575, 577, 581, 583, 587, 591, + 593, 597, 601, 605, 609, 611, 615, 619, 621, 625, + 629, 631, 635, 639, 643, 645, 649, 651, 655, 657, + 660, 663, 666, 669, 672, 675, 679, 684, 690, 696, + 703, 705, 707, 709, 711, 713, 716, 718, 720, 722, + 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, + 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, + 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, + 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, + 804, 806, 808, 810, 812, 814, 818, 820, 823, 827, + 832, 836, 839, 842, 844, 846, 848, 850, 852, 854, + 856, 858, 860, 864, 868 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 121, 0, -1, 122, -1, 121, 122, -1, 140, -1, - 131, -1, 123, -1, 132, 98, 129, 16, 125, 17, - -1, 132, 98, 129, 124, 16, 125, 17, -1, 132, - 99, 129, 16, 125, 17, -1, 132, 99, 129, 128, - 16, 125, 17, -1, 101, 129, -1, 101, 129, 100, - 130, -1, 100, 130, -1, 100, 130, 101, 129, -1, - 126, -1, -1, 127, -1, 127, 126, -1, 140, -1, - 131, -1, 123, -1, 100, 129, -1, 3, -1, 3, - 9, 129, -1, 3, -1, 3, 18, 130, -1, 133, - 134, 138, 3, 12, 139, 13, 145, -1, 133, 134, - 138, 3, 12, 13, 145, -1, 133, 134, 3, 12, - 139, 13, 145, -1, 133, 134, 3, 12, 13, 145, - -1, 133, 118, 12, 139, 13, 145, -1, 133, 118, - 12, 13, 145, -1, 133, 119, 12, 13, 145, -1, - 133, 119, 12, 139, 13, 145, -1, 133, 134, 138, - 3, 12, 139, 13, 11, -1, 133, 134, 138, 3, - 12, 13, 11, -1, 133, 134, 138, 117, 175, 12, - 139, 13, 145, -1, 133, 134, 138, 117, 12, 139, - 13, 175, 145, -1, 133, 134, 138, 117, 12, 175, - 13, 12, 139, 13, 145, -1, 133, 134, 138, 117, - 12, 139, 13, 12, 175, 13, 145, -1, 102, -1, + 122, 0, -1, 123, -1, 122, 123, -1, 141, -1, + 132, -1, 124, -1, 133, 98, 130, 16, 126, 17, + -1, 133, 98, 130, 125, 16, 126, 17, -1, 133, + 99, 130, 16, 126, 17, -1, 133, 99, 130, 129, + 16, 126, 17, -1, 101, 130, -1, 101, 130, 100, + 131, -1, 100, 131, -1, 100, 131, 101, 130, -1, + 127, -1, -1, 128, -1, 128, 127, -1, 141, -1, + 132, -1, 124, -1, 100, 130, -1, 3, -1, 3, + 9, 130, -1, 3, -1, 3, 18, 131, -1, 134, + 135, 139, 3, 12, 140, 13, 146, -1, 134, 135, + 139, 3, 12, 13, 146, -1, 134, 135, 3, 12, + 140, 13, 146, -1, 134, 135, 3, 12, 13, 146, + -1, 134, 118, 12, 140, 13, 146, -1, 134, 118, + 12, 13, 146, -1, 134, 119, 12, 13, 146, -1, + 134, 119, 12, 140, 13, 146, -1, 134, 135, 139, + 3, 12, 140, 13, 11, -1, 134, 135, 139, 3, + 12, 13, 11, -1, 134, 135, 139, 117, 179, 12, + 140, 13, 146, -1, 134, 135, 139, 117, 12, 140, + 13, 179, 146, -1, 134, 135, 139, 117, 12, 179, + 13, 12, 140, 13, 146, -1, 134, 135, 139, 117, + 12, 140, 13, 12, 179, 13, 146, -1, 102, -1, 104, -1, -1, 43, -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, -1, -1, 3, -1, 3, 71, - -1, 26, 130, 28, -1, 26, 130, 28, 71, -1, - 135, -1, 136, -1, 137, -1, 137, 151, -1, 137, - 154, -1, 137, 154, 9, 139, -1, 141, -1, 140, - 141, -1, 146, -1, 144, -1, 143, -1, 142, -1, - 145, -1, 44, 11, -1, 44, 147, 11, -1, 40, - 11, -1, 41, 11, -1, 33, 12, 147, 13, 141, - -1, 33, 12, 147, 13, 141, 35, 141, -1, 36, - 12, 147, 13, 141, -1, 38, 141, 36, 12, 147, - 13, 11, -1, 37, 12, 146, 146, 13, 141, -1, - 37, 12, 146, 146, 147, 13, 141, -1, 37, 12, - 147, 10, 147, 13, 141, -1, 64, 12, 147, 13, - 141, -1, 38, 141, 64, 12, 147, 13, 11, -1, - 39, 12, 147, 13, 141, -1, 16, 17, -1, 16, - 140, 17, -1, 11, -1, 147, 11, -1, 148, -1, - 147, 9, 148, -1, 149, -1, 148, 158, 149, -1, - 152, -1, 149, 159, 152, -1, 14, 147, 15, -1, - 14, 147, 9, 15, -1, 14, 147, 15, 150, -1, - 14, 147, 9, 15, 150, -1, 14, 15, -1, 151, - 14, 15, -1, 160, -1, 137, 153, -1, 65, 137, - 153, -1, 66, 137, 153, -1, 105, 137, 153, -1, - 76, 153, -1, 105, 76, 153, -1, 154, -1, 154, - 9, 153, -1, 3, -1, 3, 150, -1, 3, 151, - -1, 3, 12, 13, -1, 3, 12, 147, 13, -1, - 3, 12, 13, 150, -1, 3, 12, 147, 13, 150, - -1, 53, 147, 13, -1, 54, 147, 13, -1, 55, - 147, 13, -1, 90, -1, 93, -1, 77, -1, 78, - -1, 79, -1, 80, -1, 84, -1, 85, -1, 86, - -1, 95, -1, 96, -1, 97, -1, 81, -1, 82, - -1, 83, -1, 110, -1, 109, -1, 114, -1, 113, - -1, 116, -1, 115, -1, 161, -1, 161, 45, 147, - 10, 160, -1, 162, -1, 161, 31, 162, -1, 163, - -1, 162, 30, 163, -1, 164, -1, 163, 47, 164, - -1, 165, -1, 164, 49, 165, -1, 166, -1, 165, - 48, 166, -1, 167, -1, 166, 24, 167, -1, 166, - 25, 167, -1, 168, -1, 167, 26, 168, -1, 167, - 28, 168, -1, 167, 27, 168, -1, 167, 29, 168, - -1, 169, -1, 168, 88, 169, -1, 168, 87, 169, - -1, 170, -1, 169, 19, 170, -1, 169, 20, 170, - -1, 171, -1, 170, 21, 171, -1, 170, 22, 171, - -1, 170, 23, 171, -1, 172, -1, 171, 89, 172, - -1, 173, -1, 172, 52, 137, -1, 176, -1, 50, - 173, -1, 51, 173, -1, 174, 173, -1, 75, 173, - -1, 74, 173, -1, 73, 137, -1, 73, 137, 150, - -1, 73, 137, 12, 13, -1, 73, 137, 12, 147, - 13, -1, 73, 137, 12, 13, 150, -1, 73, 137, - 12, 147, 13, 150, -1, 19, -1, 20, -1, 89, - -1, 46, -1, 21, -1, 108, 89, -1, 97, -1, - 90, -1, 19, -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, - 46, -1, 47, -1, 48, -1, 49, -1, 50, -1, - 51, -1, 52, -1, 72, -1, 77, -1, 78, -1, - 79, -1, 80, -1, 81, -1, 82, -1, 83, -1, - 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, - 89, -1, 91, -1, 93, -1, 95, -1, 96, -1, - 97, -1, 109, -1, 110, -1, 113, -1, 114, -1, - 115, -1, 116, -1, 177, -1, 176, 91, 177, -1, - 178, -1, 177, 150, -1, 177, 12, 13, -1, 177, - 12, 147, 13, -1, 177, 18, 3, -1, 177, 50, - -1, 177, 51, -1, 3, -1, 6, -1, 7, -1, - 4, -1, 5, -1, 150, -1, 155, -1, 156, -1, - 157, -1, 111, 147, 112, -1, 12, 147, 13, -1, - 12, 13, -1 + -1, 26, 131, 28, -1, 26, 131, 28, 71, -1, + 136, -1, 137, -1, 138, -1, 138, 155, -1, 138, + 158, -1, 138, 158, 9, 140, -1, 142, -1, 141, + 142, -1, 150, -1, 145, -1, 144, -1, 143, -1, + 146, -1, 147, -1, 44, 11, -1, 44, 151, 11, + -1, 40, 11, -1, 41, 11, -1, 33, 12, 151, + 13, 142, -1, 33, 12, 151, 13, 142, 35, 142, + -1, 36, 12, 151, 13, 142, -1, 38, 142, 36, + 12, 151, 13, 11, -1, 37, 12, 150, 150, 13, + 142, -1, 37, 12, 150, 150, 151, 13, 142, -1, + 37, 12, 151, 10, 151, 13, 142, -1, 64, 12, + 151, 13, 142, -1, 38, 142, 64, 12, 151, 13, + 11, -1, 39, 12, 151, 13, 142, -1, 16, 17, + -1, 16, 141, 17, -1, 120, 149, -1, 120, 16, + 148, 17, -1, 149, -1, 149, 9, 148, -1, 4, + -1, 11, -1, 151, 11, -1, 152, -1, 151, 9, + 152, -1, 153, -1, 152, 162, 153, -1, 156, -1, + 153, 163, 156, -1, 14, 151, 15, -1, 14, 151, + 9, 15, -1, 14, 151, 15, 154, -1, 14, 151, + 9, 15, 154, -1, 14, 15, -1, 155, 14, 15, + -1, 164, -1, 138, 157, -1, 65, 138, 157, -1, + 66, 138, 157, -1, 105, 138, 157, -1, 76, 157, + -1, 105, 76, 157, -1, 158, -1, 158, 9, 157, + -1, 3, -1, 3, 154, -1, 3, 155, -1, 3, + 12, 13, -1, 3, 12, 151, 13, -1, 3, 12, + 13, 154, -1, 3, 12, 151, 13, 154, -1, 53, + 151, 13, -1, 54, 151, 13, -1, 55, 151, 13, + -1, 90, -1, 93, -1, 77, -1, 78, -1, 79, + -1, 80, -1, 84, -1, 85, -1, 86, -1, 95, + -1, 96, -1, 97, -1, 81, -1, 82, -1, 83, + -1, 110, -1, 109, -1, 114, -1, 113, -1, 116, + -1, 115, -1, 165, -1, 165, 45, 151, 10, 164, + -1, 166, -1, 165, 31, 166, -1, 167, -1, 166, + 30, 167, -1, 168, -1, 167, 47, 168, -1, 169, + -1, 168, 49, 169, -1, 170, -1, 169, 48, 170, + -1, 171, -1, 170, 24, 171, -1, 170, 25, 171, + -1, 172, -1, 171, 26, 172, -1, 171, 28, 172, + -1, 171, 27, 172, -1, 171, 29, 172, -1, 173, + -1, 172, 88, 173, -1, 172, 87, 173, -1, 174, + -1, 173, 19, 174, -1, 173, 20, 174, -1, 175, + -1, 174, 21, 175, -1, 174, 22, 175, -1, 174, + 23, 175, -1, 176, -1, 175, 89, 176, -1, 177, + -1, 176, 52, 138, -1, 180, -1, 50, 177, -1, + 51, 177, -1, 178, 177, -1, 75, 177, -1, 74, + 177, -1, 73, 138, -1, 73, 138, 154, -1, 73, + 138, 12, 13, -1, 73, 138, 12, 151, 13, -1, + 73, 138, 12, 13, 154, -1, 73, 138, 12, 151, + 13, 154, -1, 19, -1, 20, -1, 89, -1, 46, + -1, 21, -1, 108, 89, -1, 97, -1, 90, -1, + 19, -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, 46, -1, + 47, -1, 48, -1, 49, -1, 50, -1, 51, -1, + 52, -1, 72, -1, 77, -1, 78, -1, 79, -1, + 80, -1, 81, -1, 82, -1, 83, -1, 84, -1, + 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, + 91, -1, 93, -1, 95, -1, 96, -1, 97, -1, + 109, -1, 110, -1, 113, -1, 114, -1, 115, -1, + 116, -1, 181, -1, 180, 91, 181, -1, 182, -1, + 181, 154, -1, 181, 12, 13, -1, 181, 12, 151, + 13, -1, 181, 18, 3, -1, 181, 50, -1, 181, + 51, -1, 3, -1, 6, -1, 7, -1, 4, -1, + 5, -1, 154, -1, 159, -1, 160, -1, 161, -1, + 111, 151, 112, -1, 12, 151, 13, -1, 12, 13, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 206, 206, 207, 211, 212, 213, 217, 219, 221, - 223, 228, 229, 230, 231, 235, 236, 240, 241, 246, - 247, 248, 252, 256, 257, 261, 262, 266, 268, 270, - 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, - 292, 297, 298, 299, 303, 304, 305, 306, 310, 311, - 312, 316, 317, 321, 322, 331, 332, 337, 338, 342, - 343, 347, 348, 352, 353, 354, 355, 357, 361, 362, - 363, 364, 368, 370, 375, 377, 379, 381, 383, 385, - 387, 389, 394, 395, 399, 400, 404, 405, 409, 410, - 415, 416, 421, 422, 423, 425, 430, 431, 435, 436, - 437, 438, 439, 440, 441, 445, 446, 450, 451, 452, - 453, 454, 455, 456, 460, 465, 470, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, - 488, 489, 493, 494, 495, 496, 497, 498, 502, 503, - 508, 509, 514, 515, 520, 521, 526, 527, 532, 533, - 538, 539, 541, 546, 547, 549, 551, 553, 558, 559, - 561, 566, 567, 569, 574, 575, 577, 579, 584, 585, - 590, 591, 596, 597, 599, 601, 603, 605, 607, 609, - 611, 613, 615, 617, 624, 625, 626, 627, 628, 629, - 630, 636, 637, 638, 639, 640, 641, 642, 643, 644, - 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, - 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, - 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, - 675, 676, 677, 678, 679, 680, 681, 682, 686, 687, - 692, 693, 695, 697, 699, 701, 703, 709, 710, 711, - 712, 713, 714, 715, 716, 717, 718, 719, 720 + 0, 211, 211, 212, 216, 217, 218, 222, 224, 226, + 228, 233, 234, 235, 236, 240, 241, 245, 246, 251, + 252, 253, 257, 261, 262, 266, 267, 271, 273, 275, + 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, + 297, 302, 303, 304, 308, 309, 310, 311, 315, 316, + 317, 321, 322, 326, 327, 336, 337, 342, 343, 347, + 348, 352, 353, 357, 358, 359, 360, 362, 363, 367, + 368, 369, 370, 374, 376, 381, 383, 385, 387, 389, + 391, 393, 395, 400, 401, 405, 406, 410, 411, 414, + 419, 420, 424, 425, 429, 430, 435, 436, 441, 442, + 443, 445, 450, 451, 455, 456, 457, 458, 459, 460, + 461, 465, 466, 470, 471, 472, 473, 474, 475, 476, + 480, 485, 490, 495, 496, 497, 498, 499, 500, 501, + 502, 503, 504, 505, 506, 507, 508, 509, 513, 514, + 515, 516, 517, 518, 522, 523, 528, 529, 534, 535, + 540, 541, 546, 547, 552, 553, 558, 559, 561, 566, + 567, 569, 571, 573, 578, 579, 581, 586, 587, 589, + 594, 595, 597, 599, 604, 605, 610, 611, 616, 617, + 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, + 644, 645, 646, 647, 648, 649, 650, 656, 657, 658, + 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, + 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, + 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, + 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, + 699, 700, 701, 702, 706, 707, 712, 713, 715, 717, + 719, 721, 723, 729, 730, 731, 732, 733, 734, 735, + 736, 737, 738, 739, 740 }; #endif @@ -896,13 +903,14 @@ static const char *const yytname[] = "PUBLIC", "PROTECTED", "PRIVATE", "STATIC", "ABSTRACT", "CONST", "SPORK", "ARROW_RIGHT", "ARROW_LEFT", "L_HACK", "R_HACK", "GRUCK_RIGHT", "GRUCK_LEFT", "UNGRUCK_RIGHT", "UNGRUCK_LEFT", "AT_OP", "AT_CTOR", - "AT_DTOR", "$accept", "program", "program_section", "class_definition", - "class_ext", "class_body", "class_body2", "class_section", "iface_ext", - "id_list", "id_dot", "function_definition", "class_decl", - "function_decl", "static_decl", "type_decl_a", "type_decl_b", - "type_decl", "type_decl2", "arg_list", "statement_list", "statement", - "jump_statement", "selection_statement", "loop_statement", - "code_segment", "expression_statement", "expression", "chuck_expression", + "AT_DTOR", "AT_IMPORT", "$accept", "program", "program_section", + "class_definition", "class_ext", "class_body", "class_body2", + "class_section", "iface_ext", "id_list", "id_dot", "function_definition", + "class_decl", "function_decl", "static_decl", "type_decl_a", + "type_decl_b", "type_decl", "type_decl2", "arg_list", "statement_list", + "statement", "jump_statement", "selection_statement", "loop_statement", + "code_segment", "import_statement", "import_list", "import_target", + "expression_statement", "expression", "chuck_expression", "arrow_expression", "array_exp", "array_empty", "decl_expression", "var_decl_list", "var_decl", "complex_exp", "polar_exp", "vec_exp", "chuck_operator", "arrow_operator", "conditional_expression", @@ -932,39 +940,41 @@ static const yytype_uint16 yytoknum[] = 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374 + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 120, 121, 121, 122, 122, 122, 123, 123, 123, - 123, 124, 124, 124, 124, 125, 125, 126, 126, 127, - 127, 127, 128, 129, 129, 130, 130, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 132, 132, 132, 133, 133, 133, 133, 134, 134, - 134, 135, 135, 136, 136, 137, 137, 138, 138, 139, - 139, 140, 140, 141, 141, 141, 141, 141, 142, 142, - 142, 142, 143, 143, 144, 144, 144, 144, 144, 144, - 144, 144, 145, 145, 146, 146, 147, 147, 148, 148, - 149, 149, 150, 150, 150, 150, 151, 151, 152, 152, - 152, 152, 152, 152, 152, 153, 153, 154, 154, 154, - 154, 154, 154, 154, 155, 156, 157, 158, 158, 158, - 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - 158, 158, 159, 159, 159, 159, 159, 159, 160, 160, - 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, - 166, 166, 166, 167, 167, 167, 167, 167, 168, 168, - 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, - 172, 172, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, - 174, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 176, 176, - 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178 + 0, 121, 122, 122, 123, 123, 123, 124, 124, 124, + 124, 125, 125, 125, 125, 126, 126, 127, 127, 128, + 128, 128, 129, 130, 130, 131, 131, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 133, 133, 133, 134, 134, 134, 134, 135, 135, + 135, 136, 136, 137, 137, 138, 138, 139, 139, 140, + 140, 141, 141, 142, 142, 142, 142, 142, 142, 143, + 143, 143, 143, 144, 144, 145, 145, 145, 145, 145, + 145, 145, 145, 146, 146, 147, 147, 148, 148, 149, + 150, 150, 151, 151, 152, 152, 153, 153, 154, 154, + 154, 154, 155, 155, 156, 156, 156, 156, 156, 156, + 156, 157, 157, 158, 158, 158, 158, 158, 158, 158, + 159, 160, 161, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, + 163, 163, 163, 163, 164, 164, 165, 165, 166, 166, + 167, 167, 168, 168, 169, 169, 170, 170, 170, 171, + 171, 171, 171, 171, 172, 172, 172, 173, 173, 173, + 174, 174, 174, 174, 175, 175, 176, 176, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 179, 179, 179, 179, 180, 180, 181, 181, 181, 181, + 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, + 182, 182, 182, 182, 182 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -976,26 +986,27 @@ static const yytype_uint8 yyr2[] = 6, 6, 5, 5, 6, 8, 7, 9, 9, 11, 11, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 2, 3, 4, 1, 1, 1, 2, 2, - 4, 1, 2, 1, 1, 1, 1, 1, 2, 3, - 2, 2, 5, 7, 5, 7, 6, 7, 7, 5, - 7, 5, 2, 3, 1, 2, 1, 3, 1, 3, - 1, 3, 3, 4, 4, 5, 2, 3, 1, 2, - 3, 3, 3, 2, 3, 1, 3, 1, 2, 2, - 3, 4, 4, 5, 3, 3, 3, 1, 1, 1, + 4, 1, 2, 1, 1, 1, 1, 1, 1, 2, + 3, 2, 2, 5, 7, 5, 7, 6, 7, 7, + 5, 7, 5, 2, 3, 2, 4, 1, 3, 1, + 1, 2, 1, 3, 1, 3, 1, 3, 3, 4, + 4, 5, 2, 3, 1, 2, 3, 3, 3, 2, + 3, 1, 3, 1, 2, 2, 3, 4, 4, 5, + 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, - 3, 1, 3, 3, 1, 3, 3, 3, 1, 3, - 1, 3, 1, 2, 2, 2, 2, 2, 2, 3, - 4, 5, 5, 6, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 5, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, + 3, 3, 3, 3, 1, 3, 3, 1, 3, 3, + 1, 3, 3, 3, 1, 3, 1, 3, 1, 2, + 2, 2, 2, 2, 2, 3, 4, 5, 5, 6, + 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 2, 3, 4, 3, 2, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 3, 2 + 1, 1, 1, 1, 1, 3, 1, 2, 3, 4, + 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 3, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1003,47 +1014,48 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 43, 247, 250, 251, 248, 249, 84, 0, 0, 0, - 184, 185, 188, 0, 0, 0, 0, 0, 0, 0, - 0, 44, 0, 187, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 186, 190, 45, 46, - 47, 0, 0, 0, 43, 2, 6, 5, 0, 50, - 55, 56, 0, 4, 61, 66, 65, 64, 67, 63, - 0, 86, 88, 252, 90, 253, 254, 255, 98, 138, - 140, 142, 144, 146, 148, 150, 153, 158, 161, 164, - 168, 170, 0, 172, 238, 240, 52, 258, 0, 0, - 82, 0, 25, 0, 0, 0, 0, 0, 0, 70, - 71, 68, 0, 247, 173, 174, 0, 0, 0, 0, - 51, 0, 0, 178, 177, 176, 107, 103, 105, 0, - 0, 189, 0, 1, 3, 0, 0, 48, 49, 0, - 0, 0, 99, 62, 0, 85, 119, 120, 121, 122, - 129, 130, 131, 123, 124, 125, 117, 118, 126, 127, - 128, 0, 133, 132, 135, 134, 137, 136, 0, 0, + 43, 253, 256, 257, 254, 255, 90, 0, 0, 0, + 190, 191, 194, 0, 0, 0, 0, 0, 0, 0, + 0, 44, 0, 193, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 192, 196, 45, 46, + 47, 0, 0, 0, 0, 43, 2, 6, 5, 0, + 50, 55, 56, 0, 4, 61, 66, 65, 64, 67, + 68, 63, 0, 92, 94, 258, 96, 259, 260, 261, + 104, 144, 146, 148, 150, 152, 154, 156, 159, 164, + 167, 170, 174, 176, 0, 178, 244, 246, 52, 264, + 0, 0, 83, 0, 25, 0, 0, 0, 0, 0, + 0, 71, 72, 69, 0, 253, 179, 180, 0, 0, + 0, 0, 51, 0, 0, 184, 183, 182, 113, 109, + 111, 0, 0, 195, 0, 89, 0, 85, 1, 3, + 0, 0, 48, 49, 0, 0, 0, 105, 62, 0, + 91, 125, 126, 127, 128, 135, 136, 137, 129, 130, + 131, 123, 124, 132, 133, 134, 0, 139, 138, 141, + 140, 143, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 175, 0, 0, 0, 245, 246, 241, 257, 0, 92, - 83, 0, 53, 0, 0, 0, 0, 0, 0, 0, - 69, 114, 115, 116, 0, 100, 101, 0, 179, 0, - 0, 108, 109, 0, 104, 102, 256, 23, 0, 0, - 0, 0, 51, 57, 0, 87, 89, 91, 141, 0, - 143, 145, 147, 149, 151, 152, 154, 156, 155, 157, - 160, 159, 162, 163, 165, 166, 167, 169, 171, 239, - 242, 0, 244, 93, 94, 26, 54, 0, 0, 0, - 0, 0, 0, 0, 0, 180, 0, 110, 0, 96, - 0, 106, 0, 43, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, - 0, 243, 95, 72, 74, 0, 0, 0, 0, 0, - 81, 79, 182, 181, 112, 111, 97, 24, 21, 0, + 0, 0, 0, 0, 0, 181, 0, 0, 0, 251, + 252, 247, 263, 0, 98, 84, 0, 53, 0, 0, + 0, 0, 0, 0, 0, 70, 120, 121, 122, 0, + 106, 107, 0, 185, 0, 0, 114, 115, 0, 110, + 108, 262, 0, 87, 23, 0, 0, 0, 0, 51, + 57, 0, 93, 95, 97, 147, 0, 149, 151, 153, + 155, 157, 158, 160, 162, 161, 163, 166, 165, 168, + 169, 171, 172, 173, 175, 177, 245, 248, 0, 250, + 99, 100, 26, 54, 0, 0, 0, 0, 0, 0, + 0, 0, 186, 0, 116, 0, 102, 0, 112, 86, + 0, 0, 43, 0, 0, 0, 43, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, + 249, 101, 73, 75, 0, 0, 0, 0, 0, 82, + 80, 188, 187, 118, 117, 103, 88, 24, 21, 0, 15, 43, 20, 19, 13, 11, 43, 0, 22, 43, - 32, 59, 0, 33, 0, 0, 0, 0, 0, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 191, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 0, 139, 0, 76, - 0, 0, 0, 0, 183, 113, 7, 18, 0, 0, + 32, 59, 0, 33, 0, 0, 0, 0, 0, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 197, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 0, 145, 0, 77, + 0, 0, 0, 0, 189, 119, 7, 18, 0, 0, 0, 9, 0, 0, 31, 34, 30, 0, 0, 0, - 199, 0, 0, 0, 73, 77, 78, 75, 80, 14, + 205, 0, 0, 0, 74, 78, 79, 76, 81, 14, 12, 8, 10, 60, 29, 36, 28, 0, 0, 0, 0, 35, 27, 0, 0, 0, 0, 0, 38, 0, 37, 0, 0, 40, 39 @@ -1052,74 +1064,77 @@ static const yytype_uint16 yydefact[] = /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 44, 45, 308, 276, 309, 310, 311, 279, 218, - 93, 312, 48, 49, 131, 50, 51, 52, 224, 282, - 313, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 212, 64, 117, 118, 65, 66, 67, 151, 158, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 376, 83, 84, 85 + -1, 45, 46, 318, 285, 319, 320, 321, 288, 225, + 95, 322, 49, 50, 136, 51, 52, 53, 231, 291, + 323, 55, 56, 57, 58, 59, 60, 222, 223, 61, + 62, 63, 64, 65, 217, 66, 119, 120, 67, 68, + 69, 156, 163, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 386, 85, + 86, 87 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -313 +#define YYPACT_NINF -320 static const yytype_int16 yypact[] = { - 712, 24, -313, -313, -313, -313, -313, 1084, 1762, 821, - -313, -313, -313, 40, 51, 56, 68, 1010, 124, 143, - 146, -313, 1158, -313, 1836, 1836, 1762, 1762, 1762, 151, - 59, 59, 59, 1836, 1836, 171, -313, -313, 29, -313, - 165, 14, 97, 1762, 414, -313, -313, -313, 169, 19, - -313, -313, 171, 1010, -313, -313, -313, -313, -313, -313, - 25, 140, 55, -313, -313, -313, -313, -313, -313, 95, - 162, 154, 182, 155, 237, 212, 128, 250, 32, 153, - 160, -313, 1836, 192, 52, -313, -313, -313, 74, 37, - -313, 930, 236, 228, 1762, 1762, 1232, -3, 1762, -313, - -313, -313, 99, -313, -313, -313, 91, 132, 138, 1762, - 194, 171, 171, 134, -313, -313, 148, -313, 268, 171, - 171, -313, 3, -313, -313, 277, 277, -313, -313, 270, - 272, 62, -313, -313, 1762, -313, -313, -313, -313, -313, - -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, - -313, 1762, -313, -313, -313, -313, -313, -313, 1762, 1836, - 1762, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, - 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 59, - -313, 44, 1306, 282, -313, -313, -313, -313, 1386, 273, - -313, 40, 215, 163, 164, 1232, 218, 276, 278, 172, - -313, -313, -313, -313, 174, -313, -313, 1460, -313, 1534, - 1614, -313, 275, 171, -313, -313, -313, 283, 16, 5, - 109, 116, 7, 279, 6, 140, 55, -313, 162, 262, - 154, 182, 155, 237, 212, 212, 128, 128, 128, 128, - 250, 250, 32, 32, 153, 153, 153, 160, -313, 52, - -313, 175, -313, 273, -313, -313, -313, 1010, 1010, 1688, - 1762, 1762, 1762, 1010, 1010, 273, 184, 273, 186, -313, - 280, -313, 277, 523, 40, 277, 285, 523, 277, 286, - 287, 171, 281, 287, 291, 117, 290, 275, 284, 1929, - 1836, -313, -313, 256, -313, 1010, 189, 191, 200, 201, - -313, -313, -313, 273, -313, 273, -313, -313, -313, 289, - -313, 632, -313, 1010, 206, 208, 523, 292, -313, 523, - -313, 301, 287, -313, 287, 287, 298, 118, 297, -313, - -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, - -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, - -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, - -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, - -313, -313, -313, -313, -313, -313, 300, -313, 1010, -313, - 1010, 1010, 302, 303, -313, -313, -313, -313, 277, 40, - 313, -313, 314, 59, -313, -313, -313, 287, 73, 319, - 40, 320, 321, 59, -313, -313, -313, -313, -313, -313, - -313, -313, -313, -313, -313, -313, -313, 123, 2028, 323, - 324, -313, -313, 2126, 287, 59, 287, 325, -313, 326, - -313, 287, 287, -313, -313 + 644, 14, -320, -320, -320, -320, -320, 1191, 1869, 754, + -320, -320, -320, 35, 72, 107, 132, 974, 145, 41, + 90, -320, 1265, -320, 1943, 1943, 1869, 1869, 1869, 161, + 44, 44, 44, 1943, 1943, 147, -320, -320, 130, -320, + 148, 13, 93, 1869, 47, 314, -320, -320, -320, 154, + 24, -320, -320, 147, 974, -320, -320, -320, -320, -320, + -320, -320, 82, 141, 11, -320, -320, -320, -320, -320, + -320, 0, 149, 170, 222, 227, 224, 173, 167, 239, + 186, 187, 225, -320, 1943, 188, 36, -320, -320, -320, + 40, 113, -320, 864, 260, 252, 1869, 1869, 1339, -7, + 1869, -320, -320, -320, 185, -320, -320, -320, 53, 122, + 123, 1869, 210, 147, 147, 198, -320, -320, 221, -320, + 273, 147, 147, -320, 1, -320, 279, -320, -320, -320, + 281, 281, -320, -320, 274, 275, 64, -320, -320, 1869, + -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, + -320, -320, -320, -320, -320, -320, 1869, -320, -320, -320, + -320, -320, -320, 1869, 1943, 1869, 1943, 1943, 1943, 1943, + 1943, 1943, 1943, 1943, 1943, 1943, 1943, 1943, 1943, 1943, + 1943, 1943, 1943, 1943, 44, -320, 134, 1413, 282, -320, + -320, -320, -320, 1493, 277, -320, 35, 217, 136, 138, + 1339, 230, 280, 283, 143, -320, -320, -320, -320, 150, + -320, -320, 1567, -320, 1641, 1721, -320, 284, 147, -320, + -320, -320, 272, 285, 287, 4, 7, 43, 52, 12, + 286, 6, 141, 11, -320, 149, 251, 170, 222, 227, + 224, 173, 173, 167, 167, 167, 167, 239, 239, 186, + 186, 187, 187, 187, 225, -320, 36, -320, 156, -320, + 277, -320, -320, -320, 974, 974, 1795, 1869, 1869, 1869, + 974, 974, 277, 157, 277, 162, -320, 278, -320, -320, + 279, 281, 424, 35, 281, 288, 424, 281, 289, 290, + 147, 297, 290, 298, 85, 300, 284, 291, 2036, 1943, + -320, -320, 262, -320, 974, 163, 171, 172, 182, -320, + -320, -320, 277, -320, 277, -320, -320, -320, -320, 295, + -320, 534, -320, 974, 200, 199, 424, 296, -320, 424, + -320, 293, 290, -320, 290, 290, 303, 89, 1077, -320, + -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, + -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, + -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, + -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, + -320, -320, -320, -320, -320, -320, 310, -320, 974, -320, + 974, 974, 312, 313, -320, -320, -320, -320, 281, 35, + 315, -320, 319, 44, -320, -320, -320, 290, 48, 316, + 35, 318, 324, 44, -320, -320, -320, -320, -320, -320, + -320, -320, -320, -320, -320, -320, -320, 92, 2135, 326, + 328, -320, -320, 2233, 290, 44, 290, 329, -320, 330, + -320, 290, 290, -320, -320 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -313, -313, 271, 23, -313, -247, 30, -313, -313, -122, - -183, 31, -313, -313, -313, -313, -313, -30, -313, -214, - 35, -14, -313, -313, -313, -265, -86, -2, -112, 185, - -71, 119, 193, -38, 69, -313, -313, -313, -313, -313, - 50, -313, 195, 196, 190, 197, 198, 108, 78, 104, - 105, 76, 177, 4, -313, -312, -313, 178, -313 + -320, -320, 294, 30, -320, -258, 23, -320, -320, -126, + -183, 37, -320, -320, -320, -320, -320, -30, -320, -220, + 32, -14, -320, -320, -320, -274, -320, 65, 302, -84, + -1, -117, 192, -82, 97, 193, -41, 59, -320, -320, + -320, -320, -320, 60, -320, 197, 196, 203, 195, 202, + 99, 31, 86, 95, 62, 183, 10, -320, -319, -320, + 189, -320 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1129,49 +1144,72 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -52 static const yytype_int16 yytable[] = { - 111, 112, 113, 97, 219, 88, 89, 284, 255, 288, - 195, 120, 134, 186, 132, 320, 402, 110, 323, 285, - 102, 277, 225, 46, 106, 107, 108, -51, 104, 105, - 317, 47, 273, 197, 134, 53, 135, 114, 115, 133, - 13, 122, 208, 92, 91, 211, 188, 103, 2, 3, - 4, 5, 189, 175, 176, 177, 7, 394, 8, 395, - 396, 198, 110, 94, 182, 222, 8, 46, 95, 390, - 183, 326, 392, 205, 206, 47, 225, 133, 86, 53, - 96, 214, 215, 134, 415, 13, 180, 187, 13, 9, - 119, 314, 193, 194, 196, 86, 199, 26, 27, 28, - 134, 223, 184, 185, 201, 278, 424, 204, 134, 259, - 200, 427, 110, 399, 401, 216, 274, 275, 254, 110, - 110, 110, 280, 289, 127, 128, 159, -41, -41, 283, - 325, 398, 414, 416, 421, 13, 98, 129, 130, 9, - 160, 134, 13, 13, 13, 202, 207, 134, 8, 248, - 307, 203, 422, 315, 99, 43, 318, 100, 229, 428, - 209, 430, 210, 109, 152, 153, 433, 434, 154, 155, - 156, 157, 134, 134, 116, 271, 257, 258, 186, 413, - 251, 134, 292, 134, 134, 263, 121, 264, 291, 420, - 281, 281, 161, 134, 302, 134, 304, 303, 134, 305, - 134, 162, 380, 164, 381, 266, 410, 268, 89, 134, - 134, 429, 179, 382, 383, 171, 172, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 134, 260, 135, - 146, 163, 384, 147, 385, 148, 149, 150, 167, 168, - 169, 170, 178, 293, 294, 236, 237, 238, 239, 300, - 301, 244, 245, 246, 191, 281, 192, 296, 297, 298, - 299, 165, 166, -42, -42, 86, 409, 125, 126, 173, - 174, 134, 290, 234, 235, 240, 241, 213, 242, 243, - 217, 379, 220, 181, 221, 252, 256, 8, 261, 270, - 262, 378, 272, 286, 322, 306, 327, 281, 281, 133, - 110, 316, 319, 9, 324, 269, 386, 388, 389, 391, - 393, 397, 403, 407, 408, 124, 329, 330, 331, 332, - 333, 334, 335, 400, 337, 338, 339, 340, 341, 342, - 411, 412, 417, 418, 419, 425, 226, 426, 431, 432, - 377, 387, 287, 343, 344, 345, 346, 347, 348, 349, - 321, 227, 231, 0, 228, 247, 0, 230, 0, 249, - 232, 0, 233, 281, 404, 0, 405, 406, 0, 350, - 0, 0, 0, 281, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 0, - 366, 0, 367, 368, 369, 281, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 370, 371, 0, 0, - 372, 373, 374, 375, 123, 0, 0, 1, 2, 3, - 4, 5, 0, 0, 0, 6, 7, 0, 8, 0, + 113, 114, 115, 99, 191, 226, 90, 91, 293, 297, + 139, 122, 137, 262, 200, 330, 112, -51, 333, 412, + 282, 104, 232, 286, 294, 108, 109, 110, 327, 202, + 47, 164, 54, 213, 106, 107, 216, 48, 94, 13, + 138, 93, 124, 116, 117, 165, 112, 112, 187, 139, + 8, 125, 101, 192, 188, 112, 289, 203, 404, 425, + 405, 406, 139, 126, 9, 292, 206, 229, 400, 13, + 13, 402, 210, 211, 336, 47, 232, 54, 13, 138, + 219, 220, 48, 88, 96, 88, 189, 190, 112, 121, + 13, 139, 112, 140, 185, 198, 199, 201, 335, 204, + 324, 102, 408, 431, 283, 284, 230, 287, 9, 434, + 209, 13, 261, 221, 437, 13, 266, 409, 411, 97, + 157, 158, 193, 298, 159, 160, 161, 162, 194, 132, + 133, 139, 139, 424, 426, 207, 208, 105, 2, 3, + 4, 5, 134, 135, 98, 139, 7, 139, 8, 264, + 118, 265, 139, 432, 255, 317, 270, 100, 325, 139, + 438, 328, 440, 271, 236, 139, 139, 443, 444, 300, + 312, 139, 139, 111, 191, 314, 390, 278, 301, 166, + 139, 139, 123, 423, 391, 392, 258, 26, 27, 28, + 311, 139, 313, 430, 139, 393, 205, 290, 290, 172, + 173, 174, 175, 243, 244, 245, 246, 180, 181, 182, + 212, 273, 8, 275, 91, 439, 420, 167, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, -41, -41, + 394, 151, 395, 214, 152, 215, 153, 154, 155, 139, + 267, 140, 251, 252, 253, 43, -42, -42, 170, 171, + 302, 303, 130, 131, 176, 177, 309, 310, 178, 179, + 139, 299, 247, 248, 290, 305, 306, 307, 308, 241, + 242, 168, 419, 249, 250, 169, 183, 184, 196, 186, + 197, 88, 218, 125, 224, 259, 227, 228, 263, 279, + 389, 8, 268, 315, 280, 269, 281, 388, 277, 399, + 295, 398, 403, 337, 326, 329, 9, 290, 290, 138, + 332, 334, 396, 401, 128, 276, 407, 1, 2, 3, + 4, 5, 413, 417, 418, 6, 7, 296, 8, 427, + 9, 428, 421, 10, 11, 12, 422, 429, 435, 129, + 13, 436, 441, 442, 397, 316, 127, 14, 233, 331, + 15, 16, 17, 18, 19, 20, 234, 21, 22, 387, + 23, 235, 237, 239, 24, 25, 254, 26, 27, 28, + 238, 240, 0, 290, 414, 256, 415, 416, 29, 30, + 31, 0, 0, 290, 0, 0, 0, 32, 33, 34, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 290, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 38, 39, 40, 41, + 0, 0, 42, 0, 0, 43, 0, 1, 2, 3, + 4, 5, 0, 0, 44, 6, 7, 0, 8, 0, + 9, -16, 0, 10, 11, 12, 0, 0, 0, 0, + 13, 0, 0, 0, 0, 0, 0, 14, 0, 0, + 15, 16, 17, 18, 19, 20, 0, 21, 22, 0, + 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 38, 39, 40, 41, + 0, 0, 42, 0, 0, 43, 0, 1, 2, 3, + 4, 5, 0, 0, 44, 6, 7, 0, 8, 0, + 9, -17, 0, 10, 11, 12, 0, 0, 0, 0, + 13, 0, 0, 0, 0, 0, 0, 14, 0, 0, + 15, 16, 17, 18, 19, 20, 0, 21, 22, 0, + 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 38, 39, 40, 41, + 0, 0, 42, 0, 0, 43, 0, 1, 2, 3, + 4, 5, 0, 0, 44, 6, 7, 0, 8, 0, 9, 0, 0, 10, 11, 12, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 14, 0, 0, 15, 16, 17, 18, 19, 20, 0, 21, 22, 0, @@ -1181,226 +1219,236 @@ static const yytype_int16 yytable[] = 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 38, 39, 40, 41, - 0, 0, 42, 0, 0, 43, 1, 2, 3, 4, - 5, 0, 0, 0, 6, 7, 0, 8, 0, 9, - -16, 0, 10, 11, 12, 0, 0, 0, 0, 13, - 0, 0, 0, 0, 0, 0, 14, 0, 0, 15, - 16, 17, 18, 19, 20, 0, 21, 22, 0, 23, - 0, 0, 0, 24, 25, 0, 26, 27, 28, 0, - 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 32, 33, 34, 35, + 0, 0, 42, 0, 0, 43, 0, 1, 2, 3, + 4, 5, 0, 0, 44, 6, 7, 0, 8, 0, + 9, 92, 0, 10, 11, 12, 0, 0, 0, 0, + 13, 0, 0, 0, 0, 0, 0, 14, 0, 0, + 15, 16, 17, 18, 19, 20, 0, 0, 22, 0, + 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, + 0, 0, 42, 0, 0, 43, 0, 1, 2, 3, + 4, 5, 0, 0, 44, 6, 7, 0, 8, 0, + 9, 195, 0, 10, 11, 12, 0, 0, 0, 0, + 13, 0, 0, 0, 0, 0, 0, 14, 0, 0, + 15, 16, 17, 18, 19, 20, 0, 0, 22, 0, + 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, + 0, 0, 42, 0, 0, 43, 0, 1, 2, 3, + 4, 5, 0, 0, 44, 6, 7, 0, 8, 0, + 9, 0, 0, 10, 11, 12, 0, 0, 0, 0, + 13, 0, 0, 0, 0, 0, 0, 14, 0, 0, + 15, 16, 17, 18, 19, 20, 0, 0, 22, 0, + 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, + 112, 0, 42, 0, 0, 43, 0, 0, 0, 0, + 0, 0, 0, 0, 44, 0, 339, 340, 341, 342, + 343, 344, 345, 410, 347, 348, 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, - 37, 0, 0, 0, 0, 38, 39, 40, 41, 0, - 0, 42, 0, 0, 43, 1, 2, 3, 4, 5, - 0, 0, 0, 6, 7, 0, 8, 0, 9, -17, - 0, 10, 11, 12, 0, 0, 0, 0, 13, 0, - 0, 0, 0, 0, 0, 14, 0, 0, 15, 16, - 17, 18, 19, 20, 0, 21, 22, 0, 23, 0, - 0, 0, 24, 25, 0, 26, 27, 28, 0, 0, - 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, - 0, 0, 0, 0, 0, 32, 33, 34, 35, 0, - 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, - 0, 36, 0, 6, 7, 0, 8, 0, 9, 37, - 0, 10, 11, 12, 38, 39, 40, 41, 13, 0, - 42, 0, 0, 43, 0, 14, 0, 0, 15, 16, - 17, 18, 19, 20, 0, 21, 22, 0, 23, 0, - 0, 0, 24, 25, 0, 26, 27, 28, 0, 0, - 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, - 0, 0, 0, 0, 0, 32, 33, 34, 35, 0, + 0, 0, 0, 353, 354, 355, 356, 357, 358, 359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 0, 0, 0, 0, 0, 0, 0, 37, - 0, 0, 0, 0, 38, 39, 40, 41, 0, 0, - 42, 0, 0, 43, 1, 2, 3, 4, 5, 0, - 0, 0, 6, 7, 0, 8, 0, 9, 90, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 360, + 0, 0, 0, 0, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 0, + 376, 0, 377, 378, 379, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 380, 381, 0, 0, + 382, 383, 384, 385, 1, 2, 3, 4, 5, 0, + 0, 0, 0, 7, 89, 8, 0, 0, 0, 0, 10, 11, 12, 0, 0, 0, 0, 13, 0, 0, - 0, 0, 0, 0, 14, 0, 0, 15, 16, 17, - 18, 19, 20, 0, 0, 22, 0, 23, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, + 0, 24, 25, 0, 26, 27, 28, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, + 0, 0, 0, 0, 32, 33, 34, 35, 1, 2, + 3, 4, 5, 0, 0, 0, 103, 7, 0, 8, + 36, 0, 0, 0, 10, 11, 12, 0, 37, 0, + 0, 13, 0, 0, 0, 0, 41, 0, 0, 42, + 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, + 0, 23, 0, 0, 0, 24, 25, 0, 26, 27, + 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 30, 31, 0, 0, 0, 0, 0, 0, 32, 33, + 34, 35, 1, 2, 3, 4, 5, 0, 0, 0, + 6, 7, 0, 8, 36, 0, 0, 0, 10, 11, + 12, 0, 37, 0, 0, 13, 0, 0, 0, 0, + 41, 0, 0, 42, 0, 0, 43, 0, 0, 0, + 0, 0, 0, 0, 0, 23, 0, 0, 0, 24, + 25, 0, 26, 27, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 31, 0, 0, 0, 0, + 0, 0, 32, 33, 34, 35, 1, 2, 3, 4, + 5, 0, 0, 0, 0, 7, 257, 8, 36, 0, + 0, 0, 10, 11, 12, 0, 37, 0, 0, 13, + 0, 0, 0, 0, 41, 0, 0, 42, 0, 0, + 43, 0, 0, 0, 0, 0, 0, 0, 0, 23, + 0, 0, 0, 24, 25, 0, 26, 27, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, + 0, 0, 0, 0, 0, 0, 32, 33, 34, 35, + 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, + 5, 0, 36, 0, 0, 7, 0, 8, 260, 0, + 37, 0, 10, 11, 12, 0, 0, 0, 41, 13, + 0, 42, 0, 0, 43, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, + 0, 0, 0, 24, 25, 0, 26, 27, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, + 0, 0, 0, 0, 0, 0, 32, 33, 34, 35, + 1, 2, 3, 4, 5, 0, 0, 0, 0, 7, + 272, 8, 36, 0, 0, 0, 10, 11, 12, 0, + 37, 0, 0, 13, 0, 0, 0, 0, 41, 0, + 0, 42, 0, 0, 43, 0, 0, 0, 0, 0, + 0, 0, 0, 23, 0, 0, 0, 24, 25, 0, + 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 30, 31, 0, 0, 0, 0, 0, 0, + 32, 33, 34, 35, 1, 2, 3, 4, 5, 0, + 0, 0, 0, 7, 274, 8, 36, 0, 0, 0, + 10, 11, 12, 0, 37, 0, 0, 13, 0, 0, + 0, 0, 41, 0, 0, 42, 0, 0, 43, 0, + 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, 0, 0, 0, - 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, 35, 0, 0, + 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, + 36, 0, 0, 7, 0, 8, 276, 0, 37, 0, + 10, 11, 12, 0, 0, 0, 41, 13, 0, 42, + 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, + 0, 24, 25, 0, 26, 27, 28, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, + 0, 0, 0, 0, 32, 33, 34, 35, 1, 2, + 3, 4, 5, 0, 0, 0, 0, 7, 304, 8, + 36, 0, 0, 0, 10, 11, 12, 0, 37, 0, + 0, 13, 0, 0, 0, 0, 41, 0, 0, 42, + 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, + 0, 23, 0, 0, 0, 24, 25, 0, 26, 27, + 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 30, 31, 0, 0, 0, 0, 0, 0, 32, 33, + 34, 35, 1, 2, 3, 4, 5, 0, 0, 0, + 0, 7, 0, 8, 36, 0, 0, 0, 10, 11, + 12, 0, 37, 0, 0, 13, 0, 0, 0, 0, + 41, 0, 0, 42, 0, 0, 43, 0, 0, 0, + 0, 0, 0, 0, 0, 23, 0, 0, 0, 24, + 25, 0, 26, 27, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 31, 0, 0, 0, 0, + 0, 0, 32, 33, 34, 35, 105, 2, 3, 4, + 5, 0, 0, 0, 0, 7, 0, 8, 36, 0, + 0, 0, 10, 11, 12, 0, 37, 0, 0, 0, + 0, 0, 0, 0, 41, 0, 0, 42, 0, 0, + 43, 0, 0, 0, 0, 0, 0, 0, 0, 23, + 0, 0, 0, 24, 25, 0, 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 0, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 0, 0, 0, 0, 41, 0, 0, 42, - 0, 0, 43, 1, 2, 3, 4, 5, 0, 0, - 0, 6, 7, 0, 8, 0, 9, 190, 0, 10, - 11, 12, 0, 0, 0, 0, 13, 0, 0, 0, - 0, 0, 0, 14, 0, 0, 15, 16, 17, 18, - 19, 20, 0, 0, 22, 0, 23, 0, 0, 0, - 24, 25, 0, 26, 27, 28, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, - 0, 0, 0, 32, 33, 34, 35, 0, 0, 0, - 0, 0, 0, 1, 2, 3, 4, 5, 0, 36, - 0, 6, 7, 0, 8, 0, 9, 37, 0, 10, - 11, 12, 0, 0, 0, 41, 13, 0, 42, 0, - 0, 43, 0, 14, 0, 0, 15, 16, 17, 18, - 19, 20, 0, 0, 22, 0, 23, 0, 0, 0, - 24, 25, 0, 26, 27, 28, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, - 0, 0, 0, 32, 33, 34, 35, 1, 2, 3, - 4, 5, 0, 0, 0, 0, 7, 87, 8, 36, - 0, 0, 0, 10, 11, 12, 0, 37, 0, 0, - 13, 0, 0, 0, 0, 41, 0, 0, 42, 0, - 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, - 35, 1, 2, 3, 4, 5, 0, 0, 0, 101, - 7, 0, 8, 36, 0, 0, 0, 10, 11, 12, - 0, 37, 0, 0, 13, 0, 0, 0, 0, 41, - 0, 0, 42, 0, 0, 43, 0, 0, 0, 0, - 0, 0, 0, 0, 23, 0, 0, 0, 24, 25, - 0, 26, 27, 28, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 32, 33, 34, 35, 1, 2, 3, 4, 5, - 0, 0, 0, 6, 7, 0, 8, 36, 0, 0, - 0, 10, 11, 12, 0, 37, 0, 0, 13, 0, - 0, 0, 0, 41, 0, 0, 42, 0, 0, 43, - 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, - 0, 0, 24, 25, 0, 26, 27, 28, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 32, 33, 34, 35, 1, - 2, 3, 4, 5, 0, 0, 0, 0, 7, 250, - 8, 36, 0, 0, 0, 10, 11, 12, 0, 37, - 0, 0, 13, 0, 0, 0, 0, 41, 0, 0, - 42, 0, 0, 43, 0, 0, 0, 0, 0, 0, - 0, 0, 23, 0, 0, 0, 24, 25, 0, 26, - 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 30, 31, 0, 0, 0, 0, 0, 0, 32, - 33, 34, 35, 0, 0, 0, 0, 0, 0, 1, - 2, 3, 4, 5, 0, 36, 0, 0, 7, 0, - 8, 253, 0, 37, 0, 10, 11, 12, 0, 0, - 0, 41, 13, 0, 42, 0, 0, 43, 0, 0, + 0, 0, 0, 0, 0, 0, 32, 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 23, 0, 0, 0, 24, 25, 0, 26, - 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 30, 31, 0, 0, 0, 0, 0, 0, 32, - 33, 34, 35, 1, 2, 3, 4, 5, 0, 0, - 0, 0, 7, 265, 8, 36, 0, 0, 0, 10, - 11, 12, 0, 37, 0, 0, 13, 0, 0, 0, - 0, 41, 0, 0, 42, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, - 24, 25, 0, 26, 27, 28, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 32, 33, 34, 35, 1, 2, 3, - 4, 5, 0, 0, 0, 0, 7, 267, 8, 36, - 0, 0, 0, 10, 11, 12, 0, 37, 0, 0, - 13, 0, 0, 0, 0, 41, 0, 0, 42, 0, - 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, - 35, 0, 0, 0, 0, 0, 0, 1, 2, 3, - 4, 5, 0, 36, 0, 0, 7, 0, 8, 269, - 0, 37, 0, 10, 11, 12, 0, 0, 0, 41, - 13, 0, 42, 0, 0, 43, 0, 0, 0, 0, + 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, + 37, 0, 0, 0, 0, 0, 0, 0, 338, 0, + 0, 42, 0, 0, 43, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 0, 0, 0, 24, 25, 0, 26, 27, 28, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 32, 33, 34, - 35, 1, 2, 3, 4, 5, 0, 0, 0, 0, - 7, 295, 8, 36, 0, 0, 0, 10, 11, 12, - 0, 37, 0, 0, 13, 0, 0, 0, 0, 41, - 0, 0, 42, 0, 0, 43, 0, 0, 0, 0, - 0, 0, 0, 0, 23, 0, 0, 0, 24, 25, - 0, 26, 27, 28, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 32, 33, 34, 35, 1, 2, 3, 4, 5, - 0, 0, 0, 0, 7, 0, 8, 36, 0, 0, - 0, 10, 11, 12, 0, 37, 0, 0, 13, 0, - 0, 0, 0, 41, 0, 0, 42, 0, 0, 43, - 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, - 0, 0, 24, 25, 0, 26, 27, 28, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 32, 33, 34, 35, 103, - 2, 3, 4, 5, 0, 0, 0, 0, 7, 0, - 8, 36, 0, 0, 0, 10, 11, 12, 0, 37, - 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, - 42, 0, 0, 43, 0, 0, 0, 0, 0, 0, - 0, 0, 23, 0, 0, 0, 24, 25, 0, 26, - 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, - 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, - 0, 328, 0, 0, 42, 0, 0, 43, 329, 330, - 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 342, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 343, 344, 345, 346, 347, - 348, 349, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 353, 354, 355, 356, 357, 358, 359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 350, 0, 0, 0, 0, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 0, 366, 0, 367, 368, 369, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 370, 371, - 423, 0, 372, 373, 374, 375, 0, 329, 330, 331, - 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 343, 344, 345, 346, 347, 348, - 349, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 360, 0, + 0, 0, 0, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 0, 376, + 0, 377, 378, 379, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 380, 381, 433, 0, 382, + 383, 384, 385, 0, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 350, 0, 0, 0, 0, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, - 0, 366, 0, 367, 368, 369, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 370, 371, 0, - 0, 372, 373, 374, 375, 329, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 0, + 0, 353, 354, 355, 356, 357, 358, 359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 343, 344, 345, 346, 347, 348, 349, 0, + 0, 0, 0, 0, 0, 0, 0, 360, 0, 0, + 0, 0, 361, 362, 363, 364, 365, 366, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 0, 376, 0, + 377, 378, 379, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 380, 381, 0, 0, 382, 383, + 384, 385, 339, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 350, 351, 352, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 353, + 354, 355, 356, 357, 358, 359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 350, 0, - 0, 0, 0, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 0, 366, - 0, 367, 368, 369, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 370, 371, 0, 0, 372, - 373, 374, 375 + 0, 0, 0, 0, 0, 360, 0, 0, 0, 0, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 0, 376, 0, 377, 378, + 379, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 380, 381, 0, 0, 382, 383, 384, 385 }; static const yytype_int16 yycheck[] = { - 30, 31, 32, 17, 126, 7, 8, 221, 191, 3, - 96, 41, 9, 84, 52, 280, 328, 3, 283, 12, - 22, 16, 134, 0, 26, 27, 28, 3, 24, 25, - 277, 0, 16, 36, 9, 0, 11, 33, 34, 53, - 26, 43, 113, 3, 9, 116, 9, 3, 4, 5, - 6, 7, 15, 21, 22, 23, 12, 322, 14, 324, - 325, 64, 3, 12, 12, 3, 14, 44, 12, 316, - 18, 285, 319, 111, 112, 44, 188, 91, 71, 44, - 12, 119, 120, 9, 11, 26, 82, 13, 26, 16, - 76, 274, 94, 95, 96, 71, 98, 53, 54, 55, - 9, 131, 50, 51, 13, 100, 418, 109, 9, 195, - 11, 423, 3, 327, 328, 112, 100, 101, 189, 3, - 3, 3, 13, 117, 105, 106, 31, 98, 99, 13, - 13, 13, 397, 398, 11, 26, 12, 118, 119, 16, - 45, 9, 26, 26, 26, 13, 12, 9, 14, 179, - 272, 13, 417, 275, 11, 111, 278, 11, 160, 424, - 12, 426, 14, 12, 109, 110, 431, 432, 113, 114, - 115, 116, 9, 9, 3, 213, 13, 13, 249, 393, - 182, 9, 253, 9, 9, 13, 89, 13, 13, 403, - 220, 221, 30, 9, 265, 9, 267, 13, 9, 13, - 9, 47, 13, 48, 13, 207, 389, 209, 210, 9, - 9, 425, 52, 13, 13, 87, 88, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 9, 10, 11, - 90, 49, 303, 93, 305, 95, 96, 97, 26, 27, - 28, 29, 89, 257, 258, 167, 168, 169, 170, 263, - 264, 175, 176, 177, 18, 285, 28, 259, 260, 261, - 262, 24, 25, 98, 99, 71, 388, 98, 99, 19, - 20, 9, 10, 165, 166, 171, 172, 9, 173, 174, - 3, 295, 12, 91, 12, 3, 71, 14, 12, 14, - 12, 35, 9, 14, 13, 15, 12, 327, 328, 313, - 3, 16, 16, 16, 13, 15, 17, 101, 100, 17, - 9, 13, 12, 11, 11, 44, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 17, 17, 13, 13, 13, 12, 151, 13, 13, 13, - 290, 311, 223, 46, 47, 48, 49, 50, 51, 52, - 281, 158, 162, -1, 159, 178, -1, 161, -1, 181, - 163, -1, 164, 393, 378, -1, 380, 381, -1, 72, - -1, -1, -1, 403, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, -1, - 93, -1, 95, 96, 97, 425, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 109, 110, -1, -1, - 113, 114, 115, 116, 0, -1, -1, 3, 4, 5, - 6, 7, -1, -1, -1, 11, 12, -1, 14, -1, + 30, 31, 32, 17, 86, 131, 7, 8, 228, 3, + 9, 41, 53, 196, 98, 289, 3, 3, 292, 338, + 16, 22, 139, 16, 12, 26, 27, 28, 286, 36, + 0, 31, 0, 115, 24, 25, 118, 0, 3, 26, + 54, 9, 43, 33, 34, 45, 3, 3, 12, 9, + 14, 4, 11, 13, 18, 3, 13, 64, 332, 11, + 334, 335, 9, 16, 16, 13, 13, 3, 326, 26, + 26, 329, 113, 114, 294, 45, 193, 45, 26, 93, + 121, 122, 45, 71, 12, 71, 50, 51, 3, 76, + 26, 9, 3, 11, 84, 96, 97, 98, 13, 100, + 283, 11, 13, 11, 100, 101, 136, 100, 16, 428, + 111, 26, 194, 112, 433, 26, 200, 337, 338, 12, + 109, 110, 9, 117, 113, 114, 115, 116, 15, 105, + 106, 9, 9, 407, 408, 13, 13, 3, 4, 5, + 6, 7, 118, 119, 12, 9, 12, 9, 14, 13, + 3, 13, 9, 427, 184, 281, 13, 12, 284, 9, + 434, 287, 436, 13, 165, 9, 9, 441, 442, 13, + 13, 9, 9, 12, 256, 13, 13, 218, 260, 30, + 9, 9, 89, 403, 13, 13, 187, 53, 54, 55, + 272, 9, 274, 413, 9, 13, 11, 227, 228, 26, + 27, 28, 29, 172, 173, 174, 175, 21, 22, 23, + 12, 212, 14, 214, 215, 435, 399, 47, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 98, 99, + 312, 90, 314, 12, 93, 14, 95, 96, 97, 9, + 10, 11, 180, 181, 182, 111, 98, 99, 24, 25, + 264, 265, 98, 99, 87, 88, 270, 271, 19, 20, + 9, 10, 176, 177, 294, 266, 267, 268, 269, 170, + 171, 49, 398, 178, 179, 48, 89, 52, 18, 91, + 28, 71, 9, 4, 3, 3, 12, 12, 71, 17, + 304, 14, 12, 15, 9, 12, 9, 35, 14, 100, + 14, 101, 9, 12, 16, 16, 16, 337, 338, 323, + 13, 13, 17, 17, 0, 15, 13, 3, 4, 5, + 6, 7, 12, 11, 11, 11, 12, 230, 14, 13, + 16, 13, 17, 19, 20, 21, 17, 13, 12, 45, + 26, 13, 13, 13, 321, 280, 44, 33, 156, 290, + 36, 37, 38, 39, 40, 41, 163, 43, 44, 299, + 46, 164, 166, 168, 50, 51, 183, 53, 54, 55, + 167, 169, -1, 403, 388, 186, 390, 391, 64, 65, + 66, -1, -1, 413, -1, -1, -1, 73, 74, 75, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 89, -1, 435, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, 102, 103, 104, 105, + -1, -1, 108, -1, -1, 111, -1, 3, 4, 5, + 6, 7, -1, -1, 120, 11, 12, -1, 14, -1, + 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, + 26, -1, -1, -1, -1, -1, -1, 33, -1, -1, + 36, 37, 38, 39, 40, 41, -1, 43, 44, -1, + 46, -1, -1, -1, 50, 51, -1, 53, 54, 55, + -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, + 66, -1, -1, -1, -1, -1, -1, 73, 74, 75, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, 102, 103, 104, 105, + -1, -1, 108, -1, -1, 111, -1, 3, 4, 5, + 6, 7, -1, -1, 120, 11, 12, -1, 14, -1, + 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, + 26, -1, -1, -1, -1, -1, -1, 33, -1, -1, + 36, 37, 38, 39, 40, 41, -1, 43, 44, -1, + 46, -1, -1, -1, 50, 51, -1, 53, 54, 55, + -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, + 66, -1, -1, -1, -1, -1, -1, 73, 74, 75, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, 102, 103, 104, 105, + -1, -1, 108, -1, -1, 111, -1, 3, 4, 5, + 6, 7, -1, -1, 120, 11, 12, -1, 14, -1, 16, -1, -1, 19, 20, 21, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, 40, 41, -1, 43, 44, -1, @@ -1410,169 +1458,137 @@ static const yytype_int16 yycheck[] = 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, 102, 103, 104, 105, - -1, -1, 108, -1, -1, 111, 3, 4, 5, 6, - 7, -1, -1, -1, 11, 12, -1, 14, -1, 16, - 17, -1, 19, 20, 21, -1, -1, -1, -1, 26, - -1, -1, -1, -1, -1, -1, 33, -1, -1, 36, - 37, 38, 39, 40, 41, -1, 43, 44, -1, 46, - -1, -1, -1, 50, 51, -1, 53, 54, 55, -1, - -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, - -1, -1, -1, -1, -1, -1, 73, 74, 75, 76, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, - 97, -1, -1, -1, -1, 102, 103, 104, 105, -1, - -1, 108, -1, -1, 111, 3, 4, 5, 6, 7, - -1, -1, -1, 11, 12, -1, 14, -1, 16, 17, - -1, 19, 20, 21, -1, -1, -1, -1, 26, -1, - -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, - 38, 39, 40, 41, -1, 43, 44, -1, 46, -1, - -1, -1, 50, 51, -1, 53, 54, 55, -1, -1, - -1, -1, -1, -1, -1, -1, 64, 65, 66, -1, - -1, -1, -1, -1, -1, 73, 74, 75, 76, -1, - -1, -1, -1, -1, -1, 3, 4, 5, 6, 7, - -1, 89, -1, 11, 12, -1, 14, -1, 16, 97, - -1, 19, 20, 21, 102, 103, 104, 105, 26, -1, - 108, -1, -1, 111, -1, 33, -1, -1, 36, 37, - 38, 39, 40, 41, -1, 43, 44, -1, 46, -1, - -1, -1, 50, 51, -1, 53, 54, 55, -1, -1, - -1, -1, -1, -1, -1, -1, 64, 65, 66, -1, - -1, -1, -1, -1, -1, 73, 74, 75, 76, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 89, -1, -1, -1, -1, -1, -1, -1, 97, - -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, - 108, -1, -1, 111, 3, 4, 5, 6, 7, -1, - -1, -1, 11, 12, -1, 14, -1, 16, 17, -1, - 19, 20, 21, -1, -1, -1, -1, 26, -1, -1, - -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, - 39, 40, 41, -1, -1, 44, -1, 46, -1, -1, - -1, 50, 51, -1, 53, 54, 55, -1, -1, -1, - -1, -1, -1, -1, -1, 64, 65, 66, -1, -1, - -1, -1, -1, -1, 73, 74, 75, 76, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 89, -1, -1, -1, -1, -1, -1, -1, 97, -1, - -1, -1, -1, -1, -1, -1, 105, -1, -1, 108, - -1, -1, 111, 3, 4, 5, 6, 7, -1, -1, - -1, 11, 12, -1, 14, -1, 16, 17, -1, 19, - 20, 21, -1, -1, -1, -1, 26, -1, -1, -1, - -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, - 40, 41, -1, -1, 44, -1, 46, -1, -1, -1, - 50, 51, -1, 53, 54, 55, -1, -1, -1, -1, - -1, -1, -1, -1, 64, 65, 66, -1, -1, -1, - -1, -1, -1, 73, 74, 75, 76, -1, -1, -1, - -1, -1, -1, 3, 4, 5, 6, 7, -1, 89, - -1, 11, 12, -1, 14, -1, 16, 97, -1, 19, - 20, 21, -1, -1, -1, 105, 26, -1, 108, -1, - -1, 111, -1, 33, -1, -1, 36, 37, 38, 39, - 40, 41, -1, -1, 44, -1, 46, -1, -1, -1, - 50, 51, -1, 53, 54, 55, -1, -1, -1, -1, - -1, -1, -1, -1, 64, 65, 66, -1, -1, -1, - -1, -1, -1, 73, 74, 75, 76, 3, 4, 5, - 6, 7, -1, -1, -1, -1, 12, 13, 14, 89, - -1, -1, -1, 19, 20, 21, -1, 97, -1, -1, - 26, -1, -1, -1, -1, 105, -1, -1, 108, -1, - -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 108, -1, -1, 111, -1, 3, 4, 5, + 6, 7, -1, -1, 120, 11, 12, -1, 14, -1, + 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, + 26, -1, -1, -1, -1, -1, -1, 33, -1, -1, + 36, 37, 38, 39, 40, 41, -1, -1, 44, -1, 46, -1, -1, -1, 50, 51, -1, 53, 54, 55, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, + -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, -1, -1, -1, -1, -1, -1, 73, 74, 75, - 76, 3, 4, 5, 6, 7, -1, -1, -1, 11, - 12, -1, 14, 89, -1, -1, -1, 19, 20, 21, - -1, 97, -1, -1, 26, -1, -1, -1, -1, 105, - -1, -1, 108, -1, -1, 111, -1, -1, -1, -1, - -1, -1, -1, -1, 46, -1, -1, -1, 50, 51, - -1, 53, 54, 55, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65, 66, -1, -1, -1, -1, -1, - -1, 73, 74, 75, 76, 3, 4, 5, 6, 7, - -1, -1, -1, 11, 12, -1, 14, 89, -1, -1, - -1, 19, 20, 21, -1, 97, -1, -1, 26, -1, - -1, -1, -1, 105, -1, -1, 108, -1, -1, 111, - -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, - -1, -1, 50, 51, -1, 53, 54, 55, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, -1, - -1, -1, -1, -1, -1, 73, 74, 75, 76, 3, - 4, 5, 6, 7, -1, -1, -1, -1, 12, 13, - 14, 89, -1, -1, -1, 19, 20, 21, -1, 97, - -1, -1, 26, -1, -1, -1, -1, 105, -1, -1, - 108, -1, -1, 111, -1, -1, -1, -1, -1, -1, - -1, -1, 46, -1, -1, -1, 50, 51, -1, 53, - 54, 55, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, -1, -1, -1, -1, -1, -1, 73, - 74, 75, 76, -1, -1, -1, -1, -1, -1, 3, - 4, 5, 6, 7, -1, 89, -1, -1, 12, -1, - 14, 15, -1, 97, -1, 19, 20, 21, -1, -1, - -1, 105, 26, -1, 108, -1, -1, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 46, -1, -1, -1, 50, 51, -1, 53, - 54, 55, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, -1, -1, -1, -1, -1, -1, 73, - 74, 75, 76, 3, 4, 5, 6, 7, -1, -1, - -1, -1, 12, 13, 14, 89, -1, -1, -1, 19, - 20, 21, -1, 97, -1, -1, 26, -1, -1, -1, - -1, 105, -1, -1, 108, -1, -1, 111, -1, -1, - -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 50, 51, -1, 53, 54, 55, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65, 66, -1, -1, -1, - -1, -1, -1, 73, 74, 75, 76, 3, 4, 5, - 6, 7, -1, -1, -1, -1, 12, 13, 14, 89, - -1, -1, -1, 19, 20, 21, -1, 97, -1, -1, - 26, -1, -1, -1, -1, 105, -1, -1, 108, -1, - -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, -1, -1, -1, 105, + -1, -1, 108, -1, -1, 111, -1, 3, 4, 5, + 6, 7, -1, -1, 120, 11, 12, -1, 14, -1, + 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, + 26, -1, -1, -1, -1, -1, -1, 33, -1, -1, + 36, 37, 38, 39, 40, 41, -1, -1, 44, -1, 46, -1, -1, -1, 50, 51, -1, 53, 54, 55, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, + -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, -1, -1, -1, -1, -1, -1, 73, 74, 75, - 76, -1, -1, -1, -1, -1, -1, 3, 4, 5, - 6, 7, -1, 89, -1, -1, 12, -1, 14, 15, - -1, 97, -1, 19, 20, 21, -1, -1, -1, 105, - 26, -1, 108, -1, -1, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, -1, -1, -1, 105, + -1, -1, 108, -1, -1, 111, -1, 3, 4, 5, + 6, 7, -1, -1, 120, 11, 12, -1, 14, -1, + 16, -1, -1, 19, 20, 21, -1, -1, -1, -1, + 26, -1, -1, -1, -1, -1, -1, 33, -1, -1, + 36, 37, 38, 39, 40, 41, -1, -1, 44, -1, 46, -1, -1, -1, 50, 51, -1, 53, 54, 55, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, + -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, -1, -1, -1, -1, -1, -1, 73, 74, 75, - 76, 3, 4, 5, 6, 7, -1, -1, -1, -1, - 12, 13, 14, 89, -1, -1, -1, 19, 20, 21, - -1, 97, -1, -1, 26, -1, -1, -1, -1, 105, - -1, -1, 108, -1, -1, 111, -1, -1, -1, -1, - -1, -1, -1, -1, 46, -1, -1, -1, 50, 51, - -1, 53, 54, 55, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65, 66, -1, -1, -1, -1, -1, - -1, 73, 74, 75, 76, 3, 4, 5, 6, 7, - -1, -1, -1, -1, 12, -1, 14, 89, -1, -1, - -1, 19, 20, 21, -1, 97, -1, -1, 26, -1, - -1, -1, -1, 105, -1, -1, 108, -1, -1, 111, - -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, - -1, -1, 50, 51, -1, 53, 54, 55, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, -1, - -1, -1, -1, -1, -1, 73, 74, 75, 76, 3, - 4, 5, 6, 7, -1, -1, -1, -1, 12, -1, - 14, 89, -1, -1, -1, 19, 20, 21, -1, 97, - -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, - 108, -1, -1, 111, -1, -1, -1, -1, -1, -1, - -1, -1, 46, -1, -1, -1, 50, 51, -1, 53, - 54, 55, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, - 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, - -1, -1, -1, 97, -1, -1, -1, -1, -1, -1, - -1, 12, -1, -1, 108, -1, -1, 111, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 46, 47, 48, 49, 50, - 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 3, -1, 108, -1, -1, 111, -1, -1, -1, -1, + -1, -1, -1, -1, 120, -1, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 46, 47, 48, 49, 50, 51, 52, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, + -1, -1, -1, -1, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, -1, + 93, -1, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 109, 110, -1, -1, + 113, 114, 115, 116, 3, 4, 5, 6, 7, -1, + -1, -1, -1, 12, 13, 14, -1, -1, -1, -1, + 19, 20, 21, -1, -1, -1, -1, 26, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, + -1, 50, 51, -1, 53, 54, 55, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, -1, -1, + -1, -1, -1, -1, 73, 74, 75, 76, 3, 4, + 5, 6, 7, -1, -1, -1, 11, 12, -1, 14, + 89, -1, -1, -1, 19, 20, 21, -1, 97, -1, + -1, 26, -1, -1, -1, -1, 105, -1, -1, 108, + -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, 50, 51, -1, 53, 54, + 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 65, 66, -1, -1, -1, -1, -1, -1, 73, 74, + 75, 76, 3, 4, 5, 6, 7, -1, -1, -1, + 11, 12, -1, 14, 89, -1, -1, -1, 19, 20, + 21, -1, 97, -1, -1, 26, -1, -1, -1, -1, + 105, -1, -1, 108, -1, -1, 111, -1, -1, -1, + -1, -1, -1, -1, -1, 46, -1, -1, -1, 50, + 51, -1, 53, 54, 55, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, -1, -1, -1, -1, + -1, -1, 73, 74, 75, 76, 3, 4, 5, 6, + 7, -1, -1, -1, -1, 12, 13, 14, 89, -1, + -1, -1, 19, 20, 21, -1, 97, -1, -1, 26, + -1, -1, -1, -1, 105, -1, -1, 108, -1, -1, + 111, -1, -1, -1, -1, -1, -1, -1, -1, 46, + -1, -1, -1, 50, 51, -1, 53, 54, 55, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + -1, -1, -1, -1, -1, -1, 73, 74, 75, 76, + -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, + 7, -1, 89, -1, -1, 12, -1, 14, 15, -1, + 97, -1, 19, 20, 21, -1, -1, -1, 105, 26, + -1, 108, -1, -1, 111, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, + -1, -1, -1, 50, 51, -1, 53, 54, 55, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + -1, -1, -1, -1, -1, -1, 73, 74, 75, 76, + 3, 4, 5, 6, 7, -1, -1, -1, -1, 12, + 13, 14, 89, -1, -1, -1, 19, 20, 21, -1, + 97, -1, -1, 26, -1, -1, -1, -1, 105, -1, + -1, 108, -1, -1, 111, -1, -1, -1, -1, -1, + -1, -1, -1, 46, -1, -1, -1, 50, 51, -1, + 53, 54, 55, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, -1, -1, -1, -1, -1, -1, + 73, 74, 75, 76, 3, 4, 5, 6, 7, -1, + -1, -1, -1, 12, 13, 14, 89, -1, -1, -1, + 19, 20, 21, -1, 97, -1, -1, 26, -1, -1, + -1, -1, 105, -1, -1, 108, -1, -1, 111, -1, + -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, + -1, 50, 51, -1, 53, 54, 55, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, -1, -1, + -1, -1, -1, -1, 73, 74, 75, 76, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, -1, + 89, -1, -1, 12, -1, 14, 15, -1, 97, -1, + 19, 20, 21, -1, -1, -1, 105, 26, -1, 108, + -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, + -1, 50, 51, -1, 53, 54, 55, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, -1, -1, + -1, -1, -1, -1, 73, 74, 75, 76, 3, 4, + 5, 6, 7, -1, -1, -1, -1, 12, 13, 14, + 89, -1, -1, -1, 19, 20, 21, -1, 97, -1, + -1, 26, -1, -1, -1, -1, 105, -1, -1, 108, + -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, 50, 51, -1, 53, 54, + 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 65, 66, -1, -1, -1, -1, -1, -1, 73, 74, + 75, 76, 3, 4, 5, 6, 7, -1, -1, -1, + -1, 12, -1, 14, 89, -1, -1, -1, 19, 20, + 21, -1, 97, -1, -1, 26, -1, -1, -1, -1, + 105, -1, -1, 108, -1, -1, 111, -1, -1, -1, + -1, -1, -1, -1, -1, 46, -1, -1, -1, 50, + 51, -1, 53, 54, 55, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, -1, -1, -1, -1, + -1, -1, 73, 74, 75, 76, 3, 4, 5, 6, + 7, -1, -1, -1, -1, 12, -1, 14, 89, -1, + -1, -1, 19, 20, 21, -1, 97, -1, -1, -1, + -1, -1, -1, -1, 105, -1, -1, 108, -1, -1, + 111, -1, -1, -1, -1, -1, -1, -1, -1, 46, + -1, -1, -1, 50, 51, -1, 53, 54, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 72, -1, -1, -1, -1, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, -1, 93, -1, 95, 96, 97, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 109, 110, - 12, -1, 113, 114, 115, 116, -1, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 46, 47, 48, 49, 50, 51, - 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 73, 74, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 72, -1, -1, -1, -1, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - -1, 93, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 109, 110, -1, - -1, 113, 114, 115, 116, 19, 20, 21, 22, 23, + -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, + 97, -1, -1, -1, -1, -1, -1, -1, 12, -1, + -1, 108, -1, -1, 111, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 47, 48, 49, 50, 51, 52, -1, @@ -1581,8 +1597,27 @@ static const yytype_int16 yycheck[] = -1, -1, -1, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, -1, 93, -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 109, 110, -1, -1, 113, - 114, 115, 116 + -1, -1, -1, -1, -1, 109, 110, 12, -1, 113, + 114, 115, 116, -1, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 46, 47, 48, 49, 50, 51, 52, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, + -1, -1, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, -1, 93, -1, + 95, 96, 97, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 109, 110, -1, -1, 113, 114, + 115, 116, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, + 47, 48, 49, 50, 51, 52, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, -1, 93, -1, 95, 96, + 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 109, 110, -1, -1, 113, 114, 115, 116 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1593,46 +1628,47 @@ static const yytype_uint8 yystos[] = 19, 20, 21, 26, 33, 36, 37, 38, 39, 40, 41, 43, 44, 46, 50, 51, 53, 54, 55, 64, 65, 66, 73, 74, 75, 76, 89, 97, 102, 103, - 104, 105, 108, 111, 121, 122, 123, 131, 132, 133, - 135, 136, 137, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 152, 155, 156, 157, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 176, 177, 178, 71, 13, 147, 147, - 17, 140, 3, 130, 12, 12, 12, 141, 12, 11, - 11, 11, 147, 3, 173, 173, 147, 147, 147, 12, - 3, 137, 137, 137, 173, 173, 3, 153, 154, 76, - 137, 89, 147, 0, 122, 98, 99, 105, 106, 118, - 119, 134, 153, 141, 9, 11, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 90, 93, 95, 96, - 97, 158, 109, 110, 113, 114, 115, 116, 159, 31, - 45, 30, 47, 49, 48, 24, 25, 26, 27, 28, - 29, 87, 88, 19, 20, 21, 22, 23, 89, 52, - 173, 91, 12, 18, 50, 51, 150, 13, 9, 15, - 17, 18, 28, 147, 147, 146, 147, 36, 64, 147, - 11, 13, 13, 13, 147, 153, 153, 12, 150, 12, - 14, 150, 151, 9, 153, 153, 112, 3, 129, 129, - 12, 12, 3, 137, 138, 148, 149, 152, 162, 147, - 163, 164, 165, 166, 167, 167, 168, 168, 168, 168, - 169, 169, 170, 170, 171, 171, 171, 172, 137, 177, - 13, 147, 3, 15, 150, 130, 71, 13, 13, 146, - 10, 12, 12, 13, 13, 13, 147, 13, 147, 15, - 14, 153, 9, 16, 100, 101, 124, 16, 100, 128, - 13, 137, 139, 13, 139, 12, 14, 151, 3, 117, - 10, 13, 150, 141, 141, 13, 147, 147, 147, 147, - 141, 141, 150, 13, 150, 13, 15, 129, 123, 125, - 126, 127, 131, 140, 130, 129, 16, 125, 129, 16, - 145, 154, 13, 145, 13, 13, 139, 12, 12, 19, + 104, 105, 108, 111, 120, 122, 123, 124, 132, 133, + 134, 136, 137, 138, 141, 142, 143, 144, 145, 146, + 147, 150, 151, 152, 153, 154, 156, 159, 160, 161, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 180, 181, 182, 71, 13, + 151, 151, 17, 141, 3, 131, 12, 12, 12, 142, + 12, 11, 11, 11, 151, 3, 177, 177, 151, 151, + 151, 12, 3, 138, 138, 138, 177, 177, 3, 157, + 158, 76, 138, 89, 151, 4, 16, 149, 0, 123, + 98, 99, 105, 106, 118, 119, 135, 157, 142, 9, + 11, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 90, 93, 95, 96, 97, 162, 109, 110, 113, + 114, 115, 116, 163, 31, 45, 30, 47, 49, 48, + 24, 25, 26, 27, 28, 29, 87, 88, 19, 20, + 21, 22, 23, 89, 52, 177, 91, 12, 18, 50, + 51, 154, 13, 9, 15, 17, 18, 28, 151, 151, + 150, 151, 36, 64, 151, 11, 13, 13, 13, 151, + 157, 157, 12, 154, 12, 14, 154, 155, 9, 157, + 157, 112, 148, 149, 3, 130, 130, 12, 12, 3, + 138, 139, 152, 153, 156, 166, 151, 167, 168, 169, + 170, 171, 171, 172, 172, 172, 172, 173, 173, 174, + 174, 175, 175, 175, 176, 138, 181, 13, 151, 3, + 15, 154, 131, 71, 13, 13, 150, 10, 12, 12, + 13, 13, 13, 151, 13, 151, 15, 14, 157, 17, + 9, 9, 16, 100, 101, 125, 16, 100, 129, 13, + 138, 140, 13, 140, 12, 14, 155, 3, 117, 10, + 13, 154, 142, 142, 13, 151, 151, 151, 151, 142, + 142, 154, 13, 154, 13, 15, 148, 130, 124, 126, + 127, 128, 132, 141, 131, 130, 16, 126, 130, 16, + 146, 158, 13, 146, 13, 13, 140, 12, 12, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 46, 47, 48, 49, 50, 51, 52, 72, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 95, 96, 97, - 109, 110, 113, 114, 115, 116, 175, 160, 35, 141, - 13, 13, 13, 13, 150, 150, 17, 126, 101, 100, - 125, 17, 125, 9, 145, 145, 145, 13, 13, 139, - 26, 139, 175, 12, 141, 141, 141, 11, 11, 129, - 130, 17, 17, 139, 145, 11, 145, 13, 13, 13, - 139, 11, 145, 12, 175, 12, 13, 175, 145, 139, - 145, 13, 13, 145, 145 + 109, 110, 113, 114, 115, 116, 179, 164, 35, 142, + 13, 13, 13, 13, 154, 154, 17, 127, 101, 100, + 126, 17, 126, 9, 146, 146, 146, 13, 13, 140, + 26, 140, 179, 12, 142, 142, 142, 11, 11, 130, + 131, 17, 17, 140, 146, 11, 146, 13, 13, 13, + 140, 11, 146, 12, 179, 12, 13, 179, 146, 140, + 146, 13, 13, 146, 146 }; #define yyerrok (yyerrstatus = 0) @@ -2469,1288 +2505,1318 @@ yyparse () switch (yyn) { case 2: -#line 206 "chuck.y" +#line 211 "chuck.y" { (yyval.program) = g_program = new_program( (yyvsp[(1) - (1)].program_section), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 3: -#line 207 "chuck.y" +#line 212 "chuck.y" { (yyval.program) = g_program = append_program( (yyvsp[(1) - (2)].program), (yyvsp[(2) - (2)].program_section), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 4: -#line 211 "chuck.y" +#line 216 "chuck.y" { (yyval.program_section) = new_section_stmt( (yyvsp[(1) - (1)].stmt_list), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 5: -#line 212 "chuck.y" +#line 217 "chuck.y" { (yyval.program_section) = new_section_func_def( (yyvsp[(1) - (1)].func_def), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 6: -#line 213 "chuck.y" +#line 218 "chuck.y" { (yyval.program_section) = new_section_class_def( (yyvsp[(1) - (1)].class_def), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 7: -#line 218 "chuck.y" +#line 223 "chuck.y" { (yyval.class_def) = new_class_def( (yyvsp[(1) - (6)].ival), (yyvsp[(3) - (6)].id_list), NULL, (yyvsp[(5) - (6)].class_body), (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} break; case 8: -#line 220 "chuck.y" +#line 225 "chuck.y" { (yyval.class_def) = new_class_def( (yyvsp[(1) - (7)].ival), (yyvsp[(3) - (7)].id_list), (yyvsp[(4) - (7)].class_ext), (yyvsp[(6) - (7)].class_body), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 9: -#line 222 "chuck.y" +#line 227 "chuck.y" { (yyval.class_def) = new_iface_def( (yyvsp[(1) - (6)].ival), (yyvsp[(3) - (6)].id_list), NULL, (yyvsp[(5) - (6)].class_body), (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} break; case 10: -#line 224 "chuck.y" +#line 229 "chuck.y" { (yyval.class_def) = new_iface_def( (yyvsp[(1) - (7)].ival), (yyvsp[(3) - (7)].id_list), (yyvsp[(4) - (7)].class_ext), (yyvsp[(6) - (7)].class_body), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 11: -#line 228 "chuck.y" +#line 233 "chuck.y" { (yyval.class_ext) = new_class_ext( NULL, (yyvsp[(2) - (2)].id_list), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 12: -#line 229 "chuck.y" +#line 234 "chuck.y" { (yyval.class_ext) = new_class_ext( (yyvsp[(4) - (4)].id_list), (yyvsp[(2) - (4)].id_list), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 13: -#line 230 "chuck.y" +#line 235 "chuck.y" { (yyval.class_ext) = new_class_ext( (yyvsp[(2) - (2)].id_list), NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 14: -#line 231 "chuck.y" +#line 236 "chuck.y" { (yyval.class_ext) = new_class_ext( (yyvsp[(2) - (4)].id_list), (yyvsp[(4) - (4)].id_list), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 15: -#line 235 "chuck.y" +#line 240 "chuck.y" { (yyval.class_body) = (yyvsp[(1) - (1)].class_body); ;} break; case 16: -#line 236 "chuck.y" +#line 241 "chuck.y" { (yyval.class_body) = NULL; ;} break; case 17: -#line 240 "chuck.y" +#line 245 "chuck.y" { (yyval.class_body) = new_class_body( (yyvsp[(1) - (1)].program_section), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 18: -#line 241 "chuck.y" +#line 246 "chuck.y" { (yyval.class_body) = prepend_class_body( (yyvsp[(1) - (2)].program_section), (yyvsp[(2) - (2)].class_body), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 19: -#line 246 "chuck.y" +#line 251 "chuck.y" { (yyval.program_section) = new_section_stmt( (yyvsp[(1) - (1)].stmt_list), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 20: -#line 247 "chuck.y" +#line 252 "chuck.y" { (yyval.program_section) = new_section_func_def( (yyvsp[(1) - (1)].func_def), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 21: -#line 248 "chuck.y" +#line 253 "chuck.y" { (yyval.program_section) = new_section_class_def( (yyvsp[(1) - (1)].class_def), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 22: -#line 252 "chuck.y" +#line 257 "chuck.y" { (yyval.class_ext) = new_class_ext( NULL, (yyvsp[(2) - (2)].id_list), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 23: -#line 256 "chuck.y" +#line 261 "chuck.y" { (yyval.id_list) = new_id_list( (yyvsp[(1) - (1)].sval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column /*, &@1 */ ); ;} break; case 24: -#line 257 "chuck.y" +#line 262 "chuck.y" { (yyval.id_list) = prepend_id_list( (yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].id_list), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column /*, &@1 */ ); ;} break; case 25: -#line 261 "chuck.y" +#line 266 "chuck.y" { (yyval.id_list) = new_id_list( (yyvsp[(1) - (1)].sval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column /*, &@1*/ ); ;} break; case 26: -#line 262 "chuck.y" +#line 267 "chuck.y" { (yyval.id_list) = prepend_id_list( (yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].id_list), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column /*, &@1*/ ); ;} break; case 27: -#line 267 "chuck.y" +#line 272 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (8)].ival), (yyvsp[(2) - (8)].ival), (yyvsp[(3) - (8)].type_decl), (yyvsp[(4) - (8)].sval), (yyvsp[(6) - (8)].arg_list), (yyvsp[(8) - (8)].stmt), TRUE, (yylsp[(1) - (8)]).first_line, (yylsp[(1) - (8)]).first_column ); ;} break; case 28: -#line 269 "chuck.y" +#line 274 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (7)].ival), (yyvsp[(2) - (7)].ival), (yyvsp[(3) - (7)].type_decl), (yyvsp[(4) - (7)].sval), NULL, (yyvsp[(7) - (7)].stmt), TRUE, (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 29: -#line 271 "chuck.y" +#line 276 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (7)].ival), (yyvsp[(2) - (7)].ival), NULL, (yyvsp[(3) - (7)].sval), (yyvsp[(5) - (7)].arg_list), (yyvsp[(7) - (7)].stmt), TRUE, (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 30: -#line 273 "chuck.y" +#line 278 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (6)].ival), (yyvsp[(2) - (6)].ival), NULL, (yyvsp[(3) - (6)].sval), NULL, (yyvsp[(6) - (6)].stmt), TRUE, (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} break; case 31: -#line 275 "chuck.y" +#line 280 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (6)].ival), ae_key_instance, NULL, "@construct", (yyvsp[(4) - (6)].arg_list), (yyvsp[(6) - (6)].stmt), TRUE, (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} break; case 32: -#line 277 "chuck.y" +#line 282 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (5)].ival), ae_key_instance, NULL, "@construct", NULL, (yyvsp[(5) - (5)].stmt), TRUE, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 33: -#line 279 "chuck.y" +#line 284 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (5)].ival), ae_key_instance, NULL, "@destruct", NULL, (yyvsp[(5) - (5)].stmt), TRUE, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 34: -#line 281 "chuck.y" +#line 286 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (6)].ival), ae_key_instance, NULL, "@destruct", (yyvsp[(4) - (6)].arg_list), (yyvsp[(6) - (6)].stmt), TRUE, (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} break; case 35: -#line 283 "chuck.y" +#line 288 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (8)].ival), (yyvsp[(2) - (8)].ival), (yyvsp[(3) - (8)].type_decl), (yyvsp[(4) - (8)].sval), (yyvsp[(6) - (8)].arg_list), NULL, TRUE, (yylsp[(1) - (8)]).first_line, (yylsp[(1) - (8)]).first_column ); ;} break; case 36: -#line 285 "chuck.y" +#line 290 "chuck.y" { (yyval.func_def) = new_func_def( (yyvsp[(1) - (7)].ival), (yyvsp[(2) - (7)].ival), (yyvsp[(3) - (7)].type_decl), (yyvsp[(4) - (7)].sval), NULL, NULL, TRUE, (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 37: -#line 287 "chuck.y" +#line 292 "chuck.y" { (yyval.func_def) = new_op_overload( (yyvsp[(1) - (9)].ival), (yyvsp[(2) - (9)].ival), (yyvsp[(3) - (9)].type_decl), (yyvsp[(5) - (9)].ival), (yyvsp[(7) - (9)].arg_list), (yyvsp[(9) - (9)].stmt), TRUE, FALSE, (yylsp[(1) - (9)]).first_line, (yylsp[(1) - (9)]).first_column, (yylsp[(5) - (9)]).first_column ); ;} break; case 38: -#line 289 "chuck.y" +#line 294 "chuck.y" { (yyval.func_def) = new_op_overload( (yyvsp[(1) - (9)].ival), (yyvsp[(2) - (9)].ival), (yyvsp[(3) - (9)].type_decl), (yyvsp[(8) - (9)].ival), (yyvsp[(6) - (9)].arg_list), (yyvsp[(9) - (9)].stmt), TRUE, TRUE, (yylsp[(1) - (9)]).first_line, (yylsp[(1) - (9)]).first_column, (yylsp[(8) - (9)]).first_column ); ;} break; case 39: -#line 291 "chuck.y" +#line 296 "chuck.y" { (yyval.func_def) = new_op_overload( (yyvsp[(1) - (11)].ival), (yyvsp[(2) - (11)].ival), (yyvsp[(3) - (11)].type_decl), (yyvsp[(6) - (11)].ival), (yyvsp[(9) - (11)].arg_list), (yyvsp[(11) - (11)].stmt), TRUE, FALSE, (yylsp[(1) - (11)]).first_line, (yylsp[(1) - (11)]).first_column, (yylsp[(5) - (11)]).first_column ); ;} break; case 40: -#line 293 "chuck.y" +#line 298 "chuck.y" { (yyval.func_def) = new_op_overload( (yyvsp[(1) - (11)].ival), (yyvsp[(2) - (11)].ival), (yyvsp[(3) - (11)].type_decl), (yyvsp[(9) - (11)].ival), (yyvsp[(6) - (11)].arg_list), (yyvsp[(11) - (11)].stmt), TRUE, TRUE, (yylsp[(1) - (11)]).first_line, (yylsp[(1) - (11)]).first_column, (yylsp[(8) - (11)]).first_column ); ;} break; case 41: -#line 297 "chuck.y" +#line 302 "chuck.y" { (yyval.ival) = ae_key_public; ;} break; case 42: -#line 298 "chuck.y" +#line 303 "chuck.y" { (yyval.ival) = ae_key_private; ;} break; case 43: -#line 299 "chuck.y" +#line 304 "chuck.y" { (yyval.ival) = ae_key_private; ;} break; case 44: -#line 303 "chuck.y" +#line 308 "chuck.y" { (yyval.ival) = ae_key_func; ;} break; case 45: -#line 304 "chuck.y" +#line 309 "chuck.y" { (yyval.ival) = ae_key_public; ;} break; case 46: -#line 305 "chuck.y" +#line 310 "chuck.y" { (yyval.ival) = ae_key_protected; ;} break; case 47: -#line 306 "chuck.y" +#line 311 "chuck.y" { (yyval.ival) = ae_key_private; ;} break; case 48: -#line 310 "chuck.y" +#line 315 "chuck.y" { (yyval.ival) = ae_key_static; ;} break; case 49: -#line 311 "chuck.y" +#line 316 "chuck.y" { (yyval.ival) = ae_key_abstract; ;} break; case 50: -#line 312 "chuck.y" +#line 317 "chuck.y" { (yyval.ival) = ae_key_instance; ;} break; case 51: -#line 316 "chuck.y" +#line 321 "chuck.y" { (yyval.type_decl) = new_type_decl( new_id_list( (yyvsp[(1) - (1)].sval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column /*, &@1*/ ), 0, (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 52: -#line 317 "chuck.y" +#line 322 "chuck.y" { (yyval.type_decl) = new_type_decl( new_id_list( (yyvsp[(1) - (2)].sval), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column /*, &@1*/ ), 1, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 53: -#line 321 "chuck.y" +#line 326 "chuck.y" { (yyval.type_decl) = new_type_decl( (yyvsp[(2) - (3)].id_list), 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 54: -#line 322 "chuck.y" +#line 327 "chuck.y" { (yyval.type_decl) = new_type_decl( (yyvsp[(2) - (4)].id_list), 1, (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 55: -#line 331 "chuck.y" +#line 336 "chuck.y" { (yyval.type_decl) = (yyvsp[(1) - (1)].type_decl); ;} break; case 56: -#line 332 "chuck.y" +#line 337 "chuck.y" { (yyval.type_decl) = (yyvsp[(1) - (1)].type_decl); ;} break; case 57: -#line 337 "chuck.y" +#line 342 "chuck.y" { (yyval.type_decl) = (yyvsp[(1) - (1)].type_decl); ;} break; case 58: -#line 338 "chuck.y" +#line 343 "chuck.y" { (yyval.type_decl) = add_type_decl_array( (yyvsp[(1) - (2)].type_decl), (yyvsp[(2) - (2)].array_sub), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 59: -#line 342 "chuck.y" +#line 347 "chuck.y" { (yyval.arg_list) = new_arg_list( (yyvsp[(1) - (2)].type_decl), (yyvsp[(2) - (2)].var_decl), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 60: -#line 343 "chuck.y" +#line 348 "chuck.y" { (yyval.arg_list) = prepend_arg_list( (yyvsp[(1) - (4)].type_decl), (yyvsp[(2) - (4)].var_decl), (yyvsp[(4) - (4)].arg_list), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 61: -#line 347 "chuck.y" +#line 352 "chuck.y" { (yyval.stmt_list) = new_stmt_list( (yyvsp[(1) - (1)].stmt), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 62: -#line 348 "chuck.y" +#line 353 "chuck.y" { (yyval.stmt_list) = append_stmt_list( (yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].stmt), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 63: -#line 352 "chuck.y" +#line 357 "chuck.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;} break; case 64: -#line 353 "chuck.y" +#line 358 "chuck.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;} break; case 65: -#line 354 "chuck.y" +#line 359 "chuck.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;} break; case 66: -#line 355 "chuck.y" +#line 360 "chuck.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;} break; case 67: -#line 357 "chuck.y" +#line 362 "chuck.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;} break; case 68: -#line 361 "chuck.y" - { (yyval.stmt) = new_stmt_from_return( NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 363 "chuck.y" + { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); ;} break; case 69: -#line 362 "chuck.y" - { (yyval.stmt) = new_stmt_from_return( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 367 "chuck.y" + { (yyval.stmt) = new_stmt_from_return( NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 70: -#line 363 "chuck.y" - { (yyval.stmt) = new_stmt_from_break( (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 368 "chuck.y" + { (yyval.stmt) = new_stmt_from_return( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 71: -#line 364 "chuck.y" - { (yyval.stmt) = new_stmt_from_continue( (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 369 "chuck.y" + { (yyval.stmt) = new_stmt_from_break( (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 72: -#line 369 "chuck.y" - { (yyval.stmt) = new_stmt_from_if( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), NULL, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 370 "chuck.y" + { (yyval.stmt) = new_stmt_from_continue( (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 73: -#line 371 "chuck.y" - { (yyval.stmt) = new_stmt_from_if( (yyvsp[(3) - (7)].exp), (yyvsp[(5) - (7)].stmt), (yyvsp[(7) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} +#line 375 "chuck.y" + { (yyval.stmt) = new_stmt_from_if( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), NULL, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 74: -#line 376 "chuck.y" - { (yyval.stmt) = new_stmt_from_while( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 377 "chuck.y" + { (yyval.stmt) = new_stmt_from_if( (yyvsp[(3) - (7)].exp), (yyvsp[(5) - (7)].stmt), (yyvsp[(7) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 75: -#line 378 "chuck.y" - { (yyval.stmt) = new_stmt_from_do_while( (yyvsp[(5) - (7)].exp), (yyvsp[(2) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} +#line 382 "chuck.y" + { (yyval.stmt) = new_stmt_from_while( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 76: -#line 380 "chuck.y" - { (yyval.stmt) = new_stmt_from_for( (yyvsp[(3) - (6)].stmt), (yyvsp[(4) - (6)].stmt), NULL, (yyvsp[(6) - (6)].stmt), (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} +#line 384 "chuck.y" + { (yyval.stmt) = new_stmt_from_do_while( (yyvsp[(5) - (7)].exp), (yyvsp[(2) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 77: -#line 382 "chuck.y" - { (yyval.stmt) = new_stmt_from_for( (yyvsp[(3) - (7)].stmt), (yyvsp[(4) - (7)].stmt), (yyvsp[(5) - (7)].exp), (yyvsp[(7) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} +#line 386 "chuck.y" + { (yyval.stmt) = new_stmt_from_for( (yyvsp[(3) - (6)].stmt), (yyvsp[(4) - (6)].stmt), NULL, (yyvsp[(6) - (6)].stmt), (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} break; case 78: -#line 384 "chuck.y" - { (yyval.stmt) = new_stmt_from_foreach( (yyvsp[(3) - (7)].exp), (yyvsp[(5) - (7)].exp), (yyvsp[(7) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} +#line 388 "chuck.y" + { (yyval.stmt) = new_stmt_from_for( (yyvsp[(3) - (7)].stmt), (yyvsp[(4) - (7)].stmt), (yyvsp[(5) - (7)].exp), (yyvsp[(7) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 79: -#line 386 "chuck.y" - { (yyval.stmt) = new_stmt_from_until( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 390 "chuck.y" + { (yyval.stmt) = new_stmt_from_foreach( (yyvsp[(3) - (7)].exp), (yyvsp[(5) - (7)].exp), (yyvsp[(7) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 80: -#line 388 "chuck.y" - { (yyval.stmt) = new_stmt_from_do_until( (yyvsp[(5) - (7)].exp), (yyvsp[(2) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} +#line 392 "chuck.y" + { (yyval.stmt) = new_stmt_from_until( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 81: -#line 390 "chuck.y" - { (yyval.stmt) = new_stmt_from_loop( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 394 "chuck.y" + { (yyval.stmt) = new_stmt_from_do_until( (yyvsp[(5) - (7)].exp), (yyvsp[(2) - (7)].stmt), (yylsp[(1) - (7)]).first_line, (yylsp[(1) - (7)]).first_column ); ;} break; case 82: -#line 394 "chuck.y" - { (yyval.stmt) = new_stmt_from_code( NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 396 "chuck.y" + { (yyval.stmt) = new_stmt_from_loop( (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].stmt), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 83: -#line 395 "chuck.y" - { (yyval.stmt) = new_stmt_from_code( (yyvsp[(2) - (3)].stmt_list), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 400 "chuck.y" + { (yyval.stmt) = new_stmt_from_code( NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 84: -#line 399 "chuck.y" - { (yyval.stmt) = NULL; ;} +#line 401 "chuck.y" + { (yyval.stmt) = new_stmt_from_code( (yyvsp[(2) - (3)].stmt_list), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 85: -#line 400 "chuck.y" - { (yyval.stmt) = new_stmt_from_expression( (yyvsp[(1) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 405 "chuck.y" + { (yyval.stmt) = new_stmt_from_import( (yyvsp[(2) - (2)].import), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column );;} break; case 86: -#line 404 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 406 "chuck.y" + { (yyval.stmt) = new_stmt_from_import( (yyvsp[(3) - (4)].import), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column );;} break; case 87: -#line 405 "chuck.y" - { (yyval.exp) = append_expression( (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 410 "chuck.y" + { (yyval.import) = (yyvsp[(1) - (1)].import); ;} break; case 88: -#line 409 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 411 "chuck.y" + { (yyval.import) = prepend_import( (yyvsp[(1) - (3)].import), (yyvsp[(3) - (3)].import), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 89: -#line 411 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 414 "chuck.y" + { (yyval.import) = new_import( (yyvsp[(1) - (1)].sval), NULL, (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 90: -#line 415 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 419 "chuck.y" + { (yyval.stmt) = NULL; ;} break; case 91: -#line 417 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 420 "chuck.y" + { (yyval.stmt) = new_stmt_from_expression( (yyvsp[(1) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 92: -#line 421 "chuck.y" - { (yyval.array_sub) = new_array_sub( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 424 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 93: -#line 422 "chuck.y" - { (yyval.array_sub) = new_array_sub( (yyvsp[(2) - (4)].exp), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} +#line 425 "chuck.y" + { (yyval.exp) = append_expression( (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 94: -#line 424 "chuck.y" - { (yyval.array_sub) = prepend_array_sub( (yyvsp[(4) - (4)].array_sub), (yyvsp[(2) - (4)].exp), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} +#line 429 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 95: -#line 426 "chuck.y" - { (yyval.array_sub) = prepend_array_sub( (yyvsp[(5) - (5)].array_sub), (yyvsp[(2) - (5)].exp), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 431 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 96: -#line 430 "chuck.y" - { (yyval.array_sub) = new_array_sub( NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 435 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 97: -#line 431 "chuck.y" - { (yyval.array_sub) = prepend_array_sub( (yyvsp[(1) - (3)].array_sub), NULL, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 437 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 98: -#line 435 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 441 "chuck.y" + { (yyval.array_sub) = new_array_sub( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 99: -#line 436 "chuck.y" - { (yyval.exp) = new_exp_decl( (yyvsp[(1) - (2)].type_decl), (yyvsp[(2) - (2)].var_decl_list), 0, 0, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 442 "chuck.y" + { (yyval.array_sub) = new_array_sub( (yyvsp[(2) - (4)].exp), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 100: -#line 437 "chuck.y" - { (yyval.exp) = new_exp_decl_external( (yyvsp[(2) - (3)].type_decl), (yyvsp[(3) - (3)].var_decl_list), 0, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 444 "chuck.y" + { (yyval.array_sub) = prepend_array_sub( (yyvsp[(4) - (4)].array_sub), (yyvsp[(2) - (4)].exp), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 101: -#line 438 "chuck.y" - { (yyval.exp) = new_exp_decl_global( (yyvsp[(2) - (3)].type_decl), (yyvsp[(3) - (3)].var_decl_list), 0, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 446 "chuck.y" + { (yyval.array_sub) = prepend_array_sub( (yyvsp[(5) - (5)].array_sub), (yyvsp[(2) - (5)].exp), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 102: -#line 439 "chuck.y" - { (yyval.exp) = new_exp_decl( (yyvsp[(2) - (3)].type_decl), (yyvsp[(3) - (3)].var_decl_list), 1, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 450 "chuck.y" + { (yyval.array_sub) = new_array_sub( NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 103: -#line 440 "chuck.y" - { (yyval.exp) = new_exp_decl( NULL, (yyvsp[(2) - (2)].var_decl_list), 0, 0, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 451 "chuck.y" + { (yyval.array_sub) = prepend_array_sub( (yyvsp[(1) - (3)].array_sub), NULL, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 104: -#line 441 "chuck.y" - { (yyval.exp) = new_exp_decl( NULL, (yyvsp[(3) - (3)].var_decl_list), 1, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 455 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 105: -#line 445 "chuck.y" - { (yyval.var_decl_list) = new_var_decl_list( (yyvsp[(1) - (1)].var_decl), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} +#line 456 "chuck.y" + { (yyval.exp) = new_exp_decl( (yyvsp[(1) - (2)].type_decl), (yyvsp[(2) - (2)].var_decl_list), 0, 0, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 106: -#line 446 "chuck.y" - { (yyval.var_decl_list) = prepend_var_decl_list( (yyvsp[(1) - (3)].var_decl), (yyvsp[(3) - (3)].var_decl_list), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 457 "chuck.y" + { (yyval.exp) = new_exp_decl_external( (yyvsp[(2) - (3)].type_decl), (yyvsp[(3) - (3)].var_decl_list), 0, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 107: -#line 450 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (1)].sval), FALSE, NULL, NULL, (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} +#line 458 "chuck.y" + { (yyval.exp) = new_exp_decl_global( (yyvsp[(2) - (3)].type_decl), (yyvsp[(3) - (3)].var_decl_list), 0, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 108: -#line 451 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (2)].sval), FALSE, NULL, (yyvsp[(2) - (2)].array_sub), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 459 "chuck.y" + { (yyval.exp) = new_exp_decl( (yyvsp[(2) - (3)].type_decl), (yyvsp[(3) - (3)].var_decl_list), 1, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 109: -#line 452 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (2)].sval), FALSE, NULL, (yyvsp[(2) - (2)].array_sub), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 460 "chuck.y" + { (yyval.exp) = new_exp_decl( NULL, (yyvsp[(2) - (2)].var_decl_list), 0, 0, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 110: -#line 453 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (3)].sval), TRUE, NULL, NULL, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 461 "chuck.y" + { (yyval.exp) = new_exp_decl( NULL, (yyvsp[(3) - (3)].var_decl_list), 1, 0, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 111: -#line 454 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (4)].sval), TRUE, (yyvsp[(3) - (4)].exp), NULL, (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} +#line 465 "chuck.y" + { (yyval.var_decl_list) = new_var_decl_list( (yyvsp[(1) - (1)].var_decl), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 112: -#line 455 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (4)].sval), TRUE, NULL, (yyvsp[(4) - (4)].array_sub), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} +#line 466 "chuck.y" + { (yyval.var_decl_list) = prepend_var_decl_list( (yyvsp[(1) - (3)].var_decl), (yyvsp[(3) - (3)].var_decl_list), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 113: -#line 456 "chuck.y" - { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (5)].sval), TRUE, (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].array_sub), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 470 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (1)].sval), FALSE, NULL, NULL, (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; case 114: -#line 461 "chuck.y" - { (yyval.complex_exp) = new_complex( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 471 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (2)].sval), FALSE, NULL, (yyvsp[(2) - (2)].array_sub), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 115: -#line 466 "chuck.y" - { (yyval.polar_exp) = new_polar( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 472 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (2)].sval), FALSE, NULL, (yyvsp[(2) - (2)].array_sub), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 116: -#line 471 "chuck.y" - { (yyval.vec_exp) = new_vec( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 473 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (3)].sval), TRUE, NULL, NULL, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 117: -#line 475 "chuck.y" - { (yyval.ival) = ae_op_chuck; ;} +#line 474 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (4)].sval), TRUE, (yyvsp[(3) - (4)].exp), NULL, (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 118: -#line 476 "chuck.y" - { (yyval.ival) = ae_op_at_chuck; ;} +#line 475 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (4)].sval), TRUE, NULL, (yyvsp[(4) - (4)].array_sub), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 119: -#line 477 "chuck.y" - { (yyval.ival) = ae_op_plus_chuck; ;} +#line 476 "chuck.y" + { (yyval.var_decl) = new_var_decl( (yyvsp[(1) - (5)].sval), TRUE, (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].array_sub), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 120: -#line 478 "chuck.y" - { (yyval.ival) = ae_op_minus_chuck; ;} +#line 481 "chuck.y" + { (yyval.complex_exp) = new_complex( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 121: -#line 479 "chuck.y" - { (yyval.ival) = ae_op_times_chuck; ;} +#line 486 "chuck.y" + { (yyval.polar_exp) = new_polar( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 122: -#line 480 "chuck.y" - { (yyval.ival) = ae_op_divide_chuck; ;} +#line 491 "chuck.y" + { (yyval.vec_exp) = new_vec( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 123: -#line 481 "chuck.y" - { (yyval.ival) = ae_op_shift_right_chuck; ;} +#line 495 "chuck.y" + { (yyval.ival) = ae_op_chuck; ;} break; case 124: -#line 482 "chuck.y" - { (yyval.ival) = ae_op_shift_left_chuck; ;} +#line 496 "chuck.y" + { (yyval.ival) = ae_op_at_chuck; ;} break; case 125: -#line 483 "chuck.y" - { (yyval.ival) = ae_op_percent_chuck; ;} +#line 497 "chuck.y" + { (yyval.ival) = ae_op_plus_chuck; ;} break; case 126: -#line 484 "chuck.y" - { (yyval.ival) = ae_op_unchuck; ;} +#line 498 "chuck.y" + { (yyval.ival) = ae_op_minus_chuck; ;} break; case 127: -#line 485 "chuck.y" - { (yyval.ival) = ae_op_upchuck; ;} +#line 499 "chuck.y" + { (yyval.ival) = ae_op_times_chuck; ;} break; case 128: -#line 486 "chuck.y" - { (yyval.ival) = ae_op_downchuck; ;} +#line 500 "chuck.y" + { (yyval.ival) = ae_op_divide_chuck; ;} break; case 129: -#line 487 "chuck.y" - { (yyval.ival) = ae_op_s_and_chuck; ;} +#line 501 "chuck.y" + { (yyval.ival) = ae_op_shift_right_chuck; ;} break; case 130: -#line 488 "chuck.y" - { (yyval.ival) = ae_op_s_or_chuck; ;} +#line 502 "chuck.y" + { (yyval.ival) = ae_op_shift_left_chuck; ;} break; case 131: -#line 489 "chuck.y" - { (yyval.ival) = ae_op_s_xor_chuck; ;} +#line 503 "chuck.y" + { (yyval.ival) = ae_op_percent_chuck; ;} break; case 132: -#line 493 "chuck.y" - { (yyval.ival) = ae_op_arrow_left; ;} +#line 504 "chuck.y" + { (yyval.ival) = ae_op_unchuck; ;} break; case 133: -#line 494 "chuck.y" - { (yyval.ival) = ae_op_arrow_right; ;} +#line 505 "chuck.y" + { (yyval.ival) = ae_op_upchuck; ;} break; case 134: -#line 495 "chuck.y" - { (yyval.ival) = ae_op_gruck_left; ;} +#line 506 "chuck.y" + { (yyval.ival) = ae_op_downchuck; ;} break; case 135: -#line 496 "chuck.y" - { (yyval.ival) = ae_op_gruck_right; ;} +#line 507 "chuck.y" + { (yyval.ival) = ae_op_s_and_chuck; ;} break; case 136: -#line 497 "chuck.y" - { (yyval.ival) = ae_op_ungruck_left; ;} +#line 508 "chuck.y" + { (yyval.ival) = ae_op_s_or_chuck; ;} break; case 137: -#line 498 "chuck.y" - { (yyval.ival) = ae_op_ungruck_right; ;} +#line 509 "chuck.y" + { (yyval.ival) = ae_op_s_xor_chuck; ;} break; case 138: -#line 502 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 513 "chuck.y" + { (yyval.ival) = ae_op_arrow_left; ;} break; case 139: -#line 504 "chuck.y" - { (yyval.exp) = new_exp_from_if( (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 514 "chuck.y" + { (yyval.ival) = ae_op_arrow_right; ;} break; case 140: -#line 508 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 515 "chuck.y" + { (yyval.ival) = ae_op_gruck_left; ;} break; case 141: -#line 510 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_or, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 516 "chuck.y" + { (yyval.ival) = ae_op_gruck_right; ;} break; case 142: -#line 514 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 517 "chuck.y" + { (yyval.ival) = ae_op_ungruck_left; ;} break; case 143: -#line 516 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_and, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 518 "chuck.y" + { (yyval.ival) = ae_op_ungruck_right; ;} break; case 144: -#line 520 "chuck.y" +#line 522 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 145: -#line 522 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_s_or, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 524 "chuck.y" + { (yyval.exp) = new_exp_from_if( (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} break; case 146: -#line 526 "chuck.y" +#line 528 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 147: -#line 528 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_s_xor, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 530 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_or, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 148: -#line 532 "chuck.y" +#line 534 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 149: -#line 534 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_s_and, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 536 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_and, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 150: -#line 538 "chuck.y" +#line 540 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 151: -#line 540 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_eq, (yyvsp[(3) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 542 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_s_or, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 152: -#line 542 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_neq, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 546 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 153: -#line 546 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 548 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_s_xor, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 154: -#line 548 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_lt, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 552 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 155: -#line 550 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_gt, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 554 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_s_and, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 156: -#line 552 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_le, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 558 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 157: -#line 554 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_ge, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 560 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_eq, (yyvsp[(3) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 158: -#line 558 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 562 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_neq, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 159: -#line 560 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_shift_left, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 566 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 160: -#line 562 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_shift_right, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 568 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_lt, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 161: -#line 566 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 570 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_gt, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 162: -#line 568 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_plus, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 572 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_le, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 163: -#line 570 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_minus, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 574 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_ge, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 164: -#line 574 "chuck.y" +#line 578 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 165: -#line 576 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_times, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 580 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_shift_left, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 166: -#line 578 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_divide, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 582 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_shift_right, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 167: -#line 580 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_percent, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 586 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 168: -#line 584 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 588 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_plus, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 169: -#line 586 "chuck.y" - { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_tilda, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} +#line 590 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_minus, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 170: -#line 590 "chuck.y" +#line 594 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 171: -#line 592 "chuck.y" - { (yyval.exp) = new_exp_from_cast( (yyvsp[(3) - (3)].type_decl), (yyvsp[(1) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column ); ;} +#line 596 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_times, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 172: -#line 596 "chuck.y" - { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} +#line 598 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_divide, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 173: -#line 598 "chuck.y" - { (yyval.exp) = new_exp_from_unary( ae_op_plusplus, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 600 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_percent, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 174: -#line 600 "chuck.y" - { (yyval.exp) = new_exp_from_unary( ae_op_minusminus, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 604 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 175: -#line 602 "chuck.y" - { (yyval.exp) = new_exp_from_unary( (yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 606 "chuck.y" + { (yyval.exp) = new_exp_from_binary( (yyvsp[(1) - (3)].exp), ae_op_tilda, (yyvsp[(3) - (3)].exp), (yylsp[(2) - (3)]).first_line, (yylsp[(2) - (3)]).first_column ); ;} break; case 176: -#line 604 "chuck.y" - { (yyval.exp) = new_exp_from_unary( ae_op_typeof, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 610 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 177: -#line 606 "chuck.y" - { (yyval.exp) = new_exp_from_unary( ae_op_sizeof, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 612 "chuck.y" + { (yyval.exp) = new_exp_from_cast( (yyvsp[(3) - (3)].type_decl), (yyvsp[(1) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column ); ;} break; case 178: -#line 608 "chuck.y" - { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (2)].type_decl), FALSE, NULL, NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} +#line 616 "chuck.y" + { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; case 179: -#line 610 "chuck.y" - { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (3)].type_decl), FALSE, NULL, (yyvsp[(3) - (3)].array_sub), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} +#line 618 "chuck.y" + { (yyval.exp) = new_exp_from_unary( ae_op_plusplus, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 180: -#line 612 "chuck.y" - { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (4)].type_decl), TRUE, NULL, NULL, (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} +#line 620 "chuck.y" + { (yyval.exp) = new_exp_from_unary( ae_op_minusminus, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 181: -#line 614 "chuck.y" - { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (5)].type_decl), TRUE, (yyvsp[(4) - (5)].exp), NULL, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 622 "chuck.y" + { (yyval.exp) = new_exp_from_unary( (yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 182: -#line 616 "chuck.y" - { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (5)].type_decl), TRUE, NULL, (yyvsp[(5) - (5)].array_sub), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} +#line 624 "chuck.y" + { (yyval.exp) = new_exp_from_unary( ae_op_typeof, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 183: -#line 618 "chuck.y" - { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (6)].type_decl), TRUE, (yyvsp[(4) - (6)].exp), (yyvsp[(6) - (6)].array_sub), (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} +#line 626 "chuck.y" + { (yyval.exp) = new_exp_from_unary( ae_op_sizeof, (yyvsp[(2) - (2)].exp), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 184: -#line 624 "chuck.y" - { (yyval.ival) = ae_op_plus; ;} +#line 628 "chuck.y" + { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (2)].type_decl), FALSE, NULL, NULL, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; case 185: -#line 625 "chuck.y" - { (yyval.ival) = ae_op_minus; ;} +#line 630 "chuck.y" + { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (3)].type_decl), FALSE, NULL, (yyvsp[(3) - (3)].array_sub), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; case 186: -#line 626 "chuck.y" - { (yyval.ival) = ae_op_tilda; ;} +#line 632 "chuck.y" + { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (4)].type_decl), TRUE, NULL, NULL, (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; case 187: -#line 627 "chuck.y" +#line 634 "chuck.y" + { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (5)].type_decl), TRUE, (yyvsp[(4) - (5)].exp), NULL, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} + break; + + case 188: +#line 636 "chuck.y" + { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (5)].type_decl), TRUE, NULL, (yyvsp[(5) - (5)].array_sub), (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column ); ;} + break; + + case 189: +#line 638 "chuck.y" + { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[(2) - (6)].type_decl), TRUE, (yyvsp[(4) - (6)].exp), (yyvsp[(6) - (6)].array_sub), (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column ); ;} + break; + + case 190: +#line 644 "chuck.y" + { (yyval.ival) = ae_op_plus; ;} + break; + + case 191: +#line 645 "chuck.y" + { (yyval.ival) = ae_op_minus; ;} + break; + + case 192: +#line 646 "chuck.y" + { (yyval.ival) = ae_op_tilda; ;} + break; + + case 193: +#line 647 "chuck.y" { (yyval.ival) = ae_op_exclamation; ;} break; - case 188: -#line 628 "chuck.y" + case 194: +#line 648 "chuck.y" { (yyval.ival) = ae_op_times; ;} break; - case 189: -#line 629 "chuck.y" + case 195: +#line 649 "chuck.y" { (yyval.ival) = ae_op_spork; ;} break; - case 190: -#line 630 "chuck.y" + case 196: +#line 650 "chuck.y" { (yyval.ival) = ae_op_downchuck; ;} break; - case 191: -#line 636 "chuck.y" + case 197: +#line 656 "chuck.y" { (yyval.ival) = ae_op_chuck; ;} break; - case 192: -#line 637 "chuck.y" + case 198: +#line 657 "chuck.y" { (yyval.ival) = ae_op_plus; ;} break; - case 193: -#line 638 "chuck.y" + case 199: +#line 658 "chuck.y" { (yyval.ival) = ae_op_minus; ;} break; - case 194: -#line 639 "chuck.y" + case 200: +#line 659 "chuck.y" { (yyval.ival) = ae_op_times; ;} break; - case 195: -#line 640 "chuck.y" + case 201: +#line 660 "chuck.y" { (yyval.ival) = ae_op_divide; ;} break; - case 196: -#line 641 "chuck.y" + case 202: +#line 661 "chuck.y" { (yyval.ival) = ae_op_percent; ;} break; - case 197: -#line 642 "chuck.y" + case 203: +#line 662 "chuck.y" { (yyval.ival) = ae_op_eq; ;} break; - case 198: -#line 643 "chuck.y" + case 204: +#line 663 "chuck.y" { (yyval.ival) = ae_op_neq; ;} break; - case 199: -#line 644 "chuck.y" + case 205: +#line 664 "chuck.y" { (yyval.ival) = ae_op_lt; ;} break; - case 200: -#line 645 "chuck.y" + case 206: +#line 665 "chuck.y" { (yyval.ival) = ae_op_le; ;} break; - case 201: -#line 646 "chuck.y" + case 207: +#line 666 "chuck.y" { (yyval.ival) = ae_op_gt; ;} break; - case 202: -#line 647 "chuck.y" + case 208: +#line 667 "chuck.y" { (yyval.ival) = ae_op_ge; ;} break; - case 203: -#line 648 "chuck.y" + case 209: +#line 668 "chuck.y" { (yyval.ival) = ae_op_and; ;} break; - case 204: -#line 649 "chuck.y" + case 210: +#line 669 "chuck.y" { (yyval.ival) = ae_op_or; ;} break; - case 205: -#line 650 "chuck.y" + case 211: +#line 670 "chuck.y" { (yyval.ival) = ae_op_assign; ;} break; - case 206: -#line 651 "chuck.y" + case 212: +#line 671 "chuck.y" { (yyval.ival) = ae_op_exclamation; ;} break; - case 207: -#line 652 "chuck.y" + case 213: +#line 672 "chuck.y" { (yyval.ival) = ae_op_s_or; ;} break; - case 208: -#line 653 "chuck.y" + case 214: +#line 673 "chuck.y" { (yyval.ival) = ae_op_s_and; ;} break; - case 209: -#line 654 "chuck.y" + case 215: +#line 674 "chuck.y" { (yyval.ival) = ae_op_s_xor; ;} break; - case 210: -#line 655 "chuck.y" + case 216: +#line 675 "chuck.y" { (yyval.ival) = ae_op_plusplus; ;} break; - case 211: -#line 656 "chuck.y" + case 217: +#line 676 "chuck.y" { (yyval.ival) = ae_op_minusminus; ;} break; - case 212: -#line 657 "chuck.y" + case 218: +#line 677 "chuck.y" { (yyval.ival) = ae_op_dollar; ;} break; - case 213: -#line 658 "chuck.y" + case 219: +#line 678 "chuck.y" { (yyval.ival) = ae_op_at_at; ;} break; - case 214: -#line 659 "chuck.y" + case 220: +#line 679 "chuck.y" { (yyval.ival) = ae_op_plus_chuck; ;} break; - case 215: -#line 660 "chuck.y" + case 221: +#line 680 "chuck.y" { (yyval.ival) = ae_op_minus_chuck; ;} break; - case 216: -#line 661 "chuck.y" + case 222: +#line 681 "chuck.y" { (yyval.ival) = ae_op_times_chuck; ;} break; - case 217: -#line 662 "chuck.y" + case 223: +#line 682 "chuck.y" { (yyval.ival) = ae_op_divide_chuck; ;} break; - case 218: -#line 663 "chuck.y" + case 224: +#line 683 "chuck.y" { (yyval.ival) = ae_op_s_and_chuck; ;} break; - case 219: -#line 664 "chuck.y" + case 225: +#line 684 "chuck.y" { (yyval.ival) = ae_op_s_or_chuck; ;} break; - case 220: -#line 665 "chuck.y" + case 226: +#line 685 "chuck.y" { (yyval.ival) = ae_op_s_xor_chuck; ;} break; - case 221: -#line 666 "chuck.y" + case 227: +#line 686 "chuck.y" { (yyval.ival) = ae_op_shift_right_chuck; ;} break; - case 222: -#line 667 "chuck.y" + case 228: +#line 687 "chuck.y" { (yyval.ival) = ae_op_shift_left_chuck; ;} break; - case 223: -#line 668 "chuck.y" + case 229: +#line 688 "chuck.y" { (yyval.ival) = ae_op_percent_chuck; ;} break; - case 224: -#line 669 "chuck.y" + case 230: +#line 689 "chuck.y" { (yyval.ival) = ae_op_shift_right; ;} break; - case 225: -#line 670 "chuck.y" + case 231: +#line 690 "chuck.y" { (yyval.ival) = ae_op_shift_left; ;} break; - case 226: -#line 671 "chuck.y" + case 232: +#line 691 "chuck.y" { (yyval.ival) = ae_op_tilda; ;} break; - case 227: -#line 672 "chuck.y" + case 233: +#line 692 "chuck.y" { (yyval.ival) = ae_op_coloncolon; ;} break; - case 228: -#line 673 "chuck.y" + case 234: +#line 693 "chuck.y" { (yyval.ival) = ae_op_at_chuck; ;} break; - case 229: -#line 674 "chuck.y" + case 235: +#line 694 "chuck.y" { (yyval.ival) = ae_op_unchuck; ;} break; - case 230: -#line 675 "chuck.y" + case 236: +#line 695 "chuck.y" { (yyval.ival) = ae_op_upchuck; ;} break; - case 231: -#line 676 "chuck.y" + case 237: +#line 696 "chuck.y" { (yyval.ival) = ae_op_downchuck; ;} break; - case 232: -#line 677 "chuck.y" + case 238: +#line 697 "chuck.y" { (yyval.ival) = ae_op_arrow_right; ;} break; - case 233: -#line 678 "chuck.y" + case 239: +#line 698 "chuck.y" { (yyval.ival) = ae_op_arrow_left; ;} break; - case 234: -#line 679 "chuck.y" + case 240: +#line 699 "chuck.y" { (yyval.ival) = ae_op_gruck_right; ;} break; - case 235: -#line 680 "chuck.y" + case 241: +#line 700 "chuck.y" { (yyval.ival) = ae_op_gruck_left; ;} break; - case 236: -#line 681 "chuck.y" + case 242: +#line 701 "chuck.y" { (yyval.ival) = ae_op_ungruck_right; ;} break; - case 237: -#line 682 "chuck.y" + case 243: +#line 702 "chuck.y" { (yyval.ival) = ae_op_ungruck_left; ;} break; - case 239: -#line 688 "chuck.y" + case 245: +#line 708 "chuck.y" { (yyval.exp) = new_exp_from_dur( (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; - case 240: -#line 692 "chuck.y" + case 246: +#line 712 "chuck.y" { (yyval.exp) = (yyvsp[(1) - (1)].exp); ;} break; - case 241: -#line 694 "chuck.y" + case 247: +#line 714 "chuck.y" { (yyval.exp) = new_exp_from_array( (yyvsp[(1) - (2)].exp), (yyvsp[(2) - (2)].array_sub), (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; - case 242: -#line 696 "chuck.y" + case 248: +#line 716 "chuck.y" { (yyval.exp) = new_exp_from_func_call( (yyvsp[(1) - (3)].exp), NULL, (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; - case 243: -#line 698 "chuck.y" + case 249: +#line 718 "chuck.y" { (yyval.exp) = new_exp_from_func_call( (yyvsp[(1) - (4)].exp), (yyvsp[(3) - (4)].exp), (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column ); ;} break; - case 244: -#line 700 "chuck.y" + case 250: +#line 720 "chuck.y" { (yyval.exp) = new_exp_from_member_dot( (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].sval), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column ); ;} break; - case 245: -#line 702 "chuck.y" + case 251: +#line 722 "chuck.y" { (yyval.exp) = new_exp_from_postfix( (yyvsp[(1) - (2)].exp), ae_op_plusplus, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; - case 246: -#line 704 "chuck.y" + case 252: +#line 724 "chuck.y" { (yyval.exp) = new_exp_from_postfix( (yyvsp[(1) - (2)].exp), ae_op_minusminus, (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; - case 247: -#line 709 "chuck.y" + case 253: +#line 729 "chuck.y" { (yyval.exp) = new_exp_from_id( (yyvsp[(1) - (1)].sval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 248: -#line 710 "chuck.y" + case 254: +#line 730 "chuck.y" { (yyval.exp) = new_exp_from_int( (yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 249: -#line 711 "chuck.y" + case 255: +#line 731 "chuck.y" { (yyval.exp) = new_exp_from_float( (yyvsp[(1) - (1)].fval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 250: -#line 712 "chuck.y" + case 256: +#line 732 "chuck.y" { (yyval.exp) = new_exp_from_str( (yyvsp[(1) - (1)].sval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 251: -#line 713 "chuck.y" + case 257: +#line 733 "chuck.y" { (yyval.exp) = new_exp_from_char( (yyvsp[(1) - (1)].sval), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 252: -#line 714 "chuck.y" + case 258: +#line 734 "chuck.y" { (yyval.exp) = new_exp_from_array_lit( (yyvsp[(1) - (1)].array_sub), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 253: -#line 715 "chuck.y" + case 259: +#line 735 "chuck.y" { (yyval.exp) = new_exp_from_complex( (yyvsp[(1) - (1)].complex_exp), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 254: -#line 716 "chuck.y" + case 260: +#line 736 "chuck.y" { (yyval.exp) = new_exp_from_polar( (yyvsp[(1) - (1)].polar_exp), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 255: -#line 717 "chuck.y" + case 261: +#line 737 "chuck.y" { (yyval.exp) = new_exp_from_vec( (yyvsp[(1) - (1)].vec_exp), (yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column ); ;} break; - case 256: -#line 718 "chuck.y" + case 262: +#line 738 "chuck.y" { (yyval.exp) = new_exp_from_hack( (yyvsp[(2) - (3)].exp), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column ); ;} break; - case 257: -#line 719 "chuck.y" + case 263: +#line 739 "chuck.y" { (yyval.exp) = (yyvsp[(2) - (3)].exp); ;} break; - case 258: -#line 720 "chuck.y" + case 264: +#line 740 "chuck.y" { (yyval.exp) = new_exp_from_nil( (yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column ); ;} break; /* Line 1267 of yacc.c. */ -#line 3754 "chuck.tab.c" +#line 3820 "chuck.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4345,8 +4411,8 @@ static void yynoreturn yy_fatal_error ( const char* msg ); (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 114 -#define YY_END_OF_BUFFER 115 +#define YY_NUM_RULES 115 +#define YY_END_OF_BUFFER 116 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -4354,46 +4420,46 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[344] = +static const flex_int16_t yy_accept[350] = { 0, - 0, 0, 115, 113, 4, 6, 113, 3, 45, 113, - 20, 21, 19, 31, 113, 37, 38, 17, 15, 12, - 16, 14, 18, 104, 104, 13, 43, 25, 36, 26, - 44, 92, 103, 39, 40, 33, 113, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 41, 32, 42, 46, 5, 24, 0, 110, 0, + 0, 0, 116, 114, 4, 6, 114, 3, 45, 114, + 20, 21, 19, 31, 114, 37, 38, 17, 15, 12, + 16, 14, 18, 105, 105, 13, 43, 25, 36, 26, + 44, 92, 104, 39, 40, 33, 114, 104, 104, 104, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, + 104, 41, 32, 42, 46, 5, 24, 0, 111, 0, 9, 10, 0, 29, 0, 0, 0, 0, 7, 0, - 8, 0, 97, 108, 2, 1, 0, 108, 104, 0, - 0, 104, 0, 22, 98, 35, 27, 77, 23, 76, + 8, 0, 98, 109, 2, 1, 0, 109, 105, 0, + 0, 105, 0, 22, 99, 35, 27, 77, 23, 76, 79, 80, 0, 28, 34, 11, 0, 93, 0, 0, - 0, 103, 0, 0, 0, 111, 103, 103, 103, 55, - 103, 103, 103, 103, 103, 53, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 0, 30, 78, - 0, 0, 0, 0, 91, 86, 112, 0, 0, 0, - 0, 84, 82, 101, 99, 83, 0, 108, 85, 105, - 0, 107, 0, 106, 100, 56, 0, 102, 0, 57, - 81, 0, 0, 0, 88, 0, 0, 0, 0, 103, - 103, 103, 103, 103, 47, 60, 103, 103, 103, 61, - 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 87, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 108, 105, 107, 0, 0, 106, 0, 90, 89, - 0, 0, 0, 0, 0, 0, 0, 103, 103, 103, - 103, 54, 103, 103, 103, 103, 103, 103, 103, 103, - 70, 103, 103, 103, 103, 103, 103, 103, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 109, 0, 0, - 0, 0, 0, 0, 0, 52, 62, 71, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 72, 103, 103, 49, 48, 0, 0, 0, 0, 109, - 0, 0, 0, 0, 0, 103, 103, 103, 103, 75, - 103, 103, 103, 103, 66, 50, 58, 69, 73, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 103, 64, - 103, 103, 103, 103, 68, 103, 0, 0, 0, 0, - 0, 0, 51, 74, 59, 103, 103, 103, 0, 0, - 0, 96, 94, 0, 103, 63, 67, 0, 0, 95, - 0, 65, 0 + 0, 0, 104, 0, 0, 0, 112, 104, 104, 104, + 55, 104, 104, 104, 104, 104, 53, 104, 104, 104, + 104, 104, 104, 104, 104, 104, 104, 104, 0, 30, + 78, 0, 0, 0, 0, 91, 86, 113, 0, 0, + 0, 0, 84, 82, 102, 100, 83, 0, 109, 85, + 106, 0, 108, 0, 107, 101, 56, 0, 103, 0, + 57, 81, 0, 0, 0, 0, 88, 0, 0, 0, + 0, 104, 104, 104, 104, 104, 47, 60, 104, 104, + 104, 61, 104, 104, 104, 104, 104, 104, 104, 104, + 104, 104, 104, 87, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 109, 106, 108, 0, 0, 107, 0, + 90, 89, 0, 0, 0, 0, 0, 0, 0, 0, + 104, 104, 104, 104, 54, 104, 104, 104, 104, 104, + 104, 104, 104, 70, 104, 104, 104, 104, 104, 104, + 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 110, 0, 0, 0, 0, 0, 0, 0, 0, 52, + 62, 71, 104, 104, 104, 104, 104, 104, 104, 104, + 104, 104, 104, 104, 72, 104, 104, 49, 48, 0, + 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, + 104, 104, 104, 104, 75, 104, 104, 104, 104, 66, + + 50, 58, 69, 73, 0, 0, 0, 0, 0, 0, + 97, 0, 0, 0, 104, 64, 104, 104, 104, 104, + 68, 104, 0, 0, 0, 0, 0, 0, 51, 74, + 59, 104, 104, 104, 0, 0, 0, 96, 94, 0, + 104, 63, 67, 0, 0, 95, 0, 65, 0 } ; static const YY_CHAR yy_ec[256] = @@ -4440,99 +4506,103 @@ static const YY_CHAR yy_meta[72] = 1 } ; -static const flex_int16_t yy_base[389] = +static const flex_int16_t yy_base[395] = { 0, - 0, 0, 625, 626, 626, 626, 621, 626, 596, 65, - 609, 626, 60, 63, 580, 626, 626, 593, 59, 626, - 61, 55, 65, 88, 79, 595, 626, 77, 103, 66, - 626, 92, 0, 626, 626, 591, 55, 557, 58, 558, - 42, 60, 560, 88, 565, 73, 564, 90, 545, 554, - 558, 626, 56, 626, 626, 626, 581, 107, 626, 134, - 626, 626, 580, 626, 579, 120, 136, 578, 626, 577, - 134, 576, 626, 143, 626, 626, 575, 173, 182, 60, - 162, 153, 583, 626, 583, 142, 626, 626, 626, 626, - 626, 626, 582, 626, 143, 626, 571, 626, 540, 548, - - 537, 0, 567, 146, 191, 626, 545, 548, 535, 0, - 530, 528, 529, 531, 529, 0, 527, 523, 519, 128, - 164, 152, 525, 537, 522, 518, 526, 550, 626, 626, - 212, 0, 0, 0, 626, 626, 626, 205, 0, 0, - 0, 626, 626, 626, 626, 626, 220, 626, 626, 226, - 228, 237, 0, 242, 626, 626, 549, 626, 548, 626, - 626, 518, 513, 524, 626, 244, 0, 0, 0, 527, - 510, 178, 521, 520, 0, 521, 521, 511, 516, 0, - 500, 501, 507, 512, 511, 496, 498, 495, 507, 502, - 499, 626, 261, 0, 299, 0, 255, 0, 338, 0, - - 272, 302, 236, 626, 104, 249, 271, 294, 626, 626, - 492, 415, 416, 321, 0, 368, 0, 420, 406, 404, - 411, 0, 175, 398, 414, 408, 377, 380, 375, 370, - 0, 377, 360, 365, 358, 352, 353, 357, 214, 0, - 0, 0, 141, 0, 0, 0, 306, 371, 342, 343, - 353, 259, 0, 0, 0, 0, 0, 0, 340, 348, - 338, 329, 326, 324, 328, 315, 329, 328, 312, 316, - 0, 321, 317, 0, 0, 0, 0, 0, 0, 626, - 306, 301, 301, 0, 0, 295, 295, 310, 296, 0, - 304, 306, 292, 277, 0, 0, 0, 0, 0, 0, - - 249, 0, 147, 274, 288, 261, 0, 270, 269, 0, - 258, 247, 241, 237, 0, 226, 0, 0, 223, 207, - 203, 0, 0, 0, 0, 190, 195, 177, 0, 0, - 85, 626, 626, 0, 30, 0, 0, 0, 0, 626, - 0, 0, 626, 426, 434, 438, 446, 453, 460, 465, - 470, 474, 476, 478, 480, 482, 484, 486, 488, 490, - 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, - 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, - 532, 534, 536, 538, 540, 542, 544, 546 + 0, 0, 631, 632, 632, 632, 627, 632, 602, 65, + 615, 632, 60, 63, 586, 632, 632, 599, 59, 632, + 61, 55, 65, 88, 79, 601, 632, 77, 103, 66, + 632, 92, 0, 632, 632, 597, 55, 563, 58, 564, + 42, 60, 566, 91, 571, 73, 570, 90, 551, 560, + 564, 632, 56, 632, 632, 632, 587, 125, 632, 134, + 632, 632, 586, 632, 585, 141, 136, 584, 632, 583, + 133, 582, 632, 155, 632, 632, 581, 162, 197, 60, + 147, 124, 589, 632, 589, 154, 632, 632, 632, 632, + 632, 632, 588, 632, 165, 632, 577, 632, 546, 554, + + 546, 542, 0, 572, 162, 187, 632, 550, 553, 540, + 0, 535, 533, 534, 536, 534, 0, 532, 528, 524, + 169, 155, 162, 530, 542, 527, 523, 531, 555, 632, + 632, 207, 0, 0, 0, 632, 632, 632, 220, 0, + 0, 0, 632, 632, 632, 632, 632, 222, 632, 632, + 233, 235, 242, 0, 230, 632, 632, 554, 632, 553, + 632, 632, 523, 518, 519, 528, 632, 258, 0, 0, + 0, 531, 514, 175, 525, 524, 0, 525, 525, 515, + 520, 0, 504, 505, 511, 516, 515, 500, 502, 499, + 511, 506, 503, 632, 265, 0, 300, 0, 262, 0, + + 339, 0, 287, 303, 275, 632, 127, 214, 280, 360, + 632, 632, 496, 494, 497, 494, 260, 0, 369, 0, + 499, 491, 489, 497, 0, 174, 487, 503, 498, 486, + 425, 420, 414, 0, 415, 399, 403, 400, 394, 395, + 381, 206, 0, 0, 0, 182, 0, 0, 0, 306, + 343, 350, 351, 349, 363, 218, 0, 0, 0, 0, + 0, 0, 350, 358, 348, 351, 344, 341, 346, 333, + 347, 328, 312, 312, 0, 321, 317, 0, 0, 0, + 0, 0, 0, 632, 303, 296, 295, 294, 0, 0, + 292, 291, 299, 284, 0, 291, 291, 268, 253, 0, + + 0, 0, 0, 0, 0, 313, 0, 278, 251, 265, + 632, 247, 0, 250, 251, 0, 243, 238, 220, 228, + 0, 221, 0, 0, 192, 145, 130, 0, 0, 0, + 0, 109, 95, 90, 0, 0, 52, 632, 632, 0, + 30, 0, 0, 0, 0, 632, 0, 0, 632, 419, + 427, 431, 439, 446, 453, 458, 463, 467, 469, 471, + 473, 475, 477, 479, 481, 483, 485, 487, 489, 491, + 493, 495, 497, 499, 501, 503, 505, 507, 509, 511, + 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, + 533, 535, 537, 539 + } ; -static const flex_int16_t yy_def[389] = +static const flex_int16_t yy_def[395] = { 0, - 343, 1, 343, 343, 343, 343, 343, 343, 343, 344, - 343, 343, 343, 343, 345, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 346, 343, 343, 343, 347, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 343, 343, 343, 343, 343, 343, 344, 343, 348, - 343, 343, 343, 343, 343, 345, 349, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 350, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - - 343, 346, 343, 347, 351, 343, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 343, 343, 343, - 344, 352, 353, 354, 343, 343, 343, 345, 355, 356, - 357, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 358, 350, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 347, 359, 360, 361, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 343, 344, 362, 344, 363, 345, 364, 345, 365, - - 343, 343, 343, 343, 358, 358, 343, 343, 343, 343, - 343, 343, 343, 347, 366, 347, 367, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 344, 368, - 195, 369, 345, 370, 199, 371, 343, 343, 343, 343, - 343, 347, 372, 216, 373, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 374, 375, 376, 377, 343, - 343, 343, 343, 378, 379, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 380, - - 344, 381, 345, 343, 343, 343, 382, 347, 346, 346, - 346, 346, 346, 346, 346, 346, 383, 384, 343, 343, - 343, 385, 346, 346, 346, 346, 346, 346, 386, 387, - 343, 343, 343, 388, 346, 346, 346, 375, 377, 343, - 379, 346, 0, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343 + 349, 1, 349, 349, 349, 349, 349, 349, 349, 350, + 349, 349, 349, 349, 351, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 352, 349, 349, 349, 353, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 349, 349, 349, 349, 349, 349, 350, 349, 354, + 349, 349, 349, 349, 349, 351, 355, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 356, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + + 349, 349, 352, 349, 353, 357, 349, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 349, 349, + 349, 350, 358, 359, 360, 349, 349, 349, 351, 361, + 362, 363, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 364, 356, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 353, 365, 366, + 367, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 349, 350, 368, 350, 369, 351, 370, + + 351, 371, 349, 349, 349, 349, 364, 364, 349, 349, + 349, 349, 349, 349, 349, 349, 353, 372, 353, 373, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 350, 374, 197, 375, 351, 376, 201, 377, 349, + 349, 349, 349, 349, 349, 353, 378, 219, 379, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 380, + 381, 382, 383, 349, 349, 349, 349, 349, 384, 385, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + + 352, 352, 352, 352, 386, 350, 387, 351, 349, 349, + 349, 349, 388, 353, 352, 352, 352, 352, 352, 352, + 352, 352, 389, 390, 349, 349, 349, 391, 352, 352, + 352, 352, 352, 352, 392, 393, 349, 349, 349, 394, + 352, 352, 352, 381, 383, 349, 385, 352, 0, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349 + } ; -static const flex_int16_t yy_nxt[698] = +static const flex_int16_t yy_nxt[704] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, @@ -4542,78 +4612,79 @@ static const flex_int16_t yy_nxt[698] = 43, 33, 44, 33, 33, 33, 45, 33, 46, 47, 48, 49, 50, 33, 51, 33, 33, 52, 53, 54, 55, 59, 62, 64, 69, 74, 74, 74, 71, 75, - 150, 150, 128, 93, 76, 70, 63, 72, 73, 65, - 342, 77, 94, 95, 85, 105, 111, 78, 106, 79, - - 79, 79, 86, 87, 96, 60, 78, 112, 79, 79, - 79, 81, 108, 59, 82, 109, 82, 113, 97, 80, - 81, 98, 114, 82, 129, 82, 83, 81, 88, 89, - 90, 137, 120, 82, 80, 121, 81, 116, 99, 100, - 208, 82, 82, 117, 118, 91, 340, 60, 123, 101, - 82, 124, 137, 83, 131, 131, 138, 138, 137, 144, - 67, 145, 208, 74, 74, 74, 92, 156, 157, 159, - 160, 132, 133, 139, 140, 147, 148, 151, 148, 151, - 181, 67, 152, 152, 152, 182, 105, 67, 82, 106, - 82, 147, 148, 74, 74, 74, 134, 148, 141, 133, - - 78, 140, 79, 79, 79, 147, 148, 82, 148, 183, - 185, 166, 166, 186, 81, 82, 137, 82, 59, 82, - 59, 147, 148, 184, 337, 197, 197, 148, 167, 168, - 81, 260, 193, 193, 261, 201, 82, 201, 220, 221, - 202, 202, 202, 336, 82, 67, 150, 150, 152, 152, - 152, 335, 60, 169, 60, 59, 168, 152, 152, 152, - 206, 203, 333, 203, 214, 214, 137, 59, 332, 331, - 204, 203, 204, 203, 328, 243, 243, 207, 208, 207, - 203, 239, 239, 327, 105, 208, 204, 106, 203, 60, - 203, 204, 202, 202, 202, 67, 207, 326, 203, 105, - - 208, 60, 106, 325, 207, 59, 207, 208, 207, 247, - 105, 247, 324, 106, 248, 248, 248, 323, 321, 241, - 241, 241, 202, 202, 202, 207, 248, 248, 248, 241, - 241, 241, 241, 207, 320, 148, 319, 148, 316, 60, - 315, 252, 252, 241, 241, 241, 241, 241, 241, 137, - 314, 148, 313, 312, 311, 310, 148, 309, 245, 245, - 245, 105, 306, 305, 106, 304, 299, 298, 245, 245, - 245, 245, 297, 296, 295, 294, 293, 292, 67, 291, - 290, 289, 245, 245, 245, 245, 245, 245, 254, 254, - 254, 248, 248, 248, 288, 287, 286, 283, 254, 254, - - 254, 254, 282, 281, 280, 275, 280, 274, 105, 273, - 272, 106, 254, 254, 254, 254, 254, 254, 271, 270, - 280, 269, 268, 267, 266, 280, 58, 58, 58, 58, - 58, 58, 58, 58, 66, 66, 265, 66, 66, 66, - 66, 66, 102, 102, 102, 102, 104, 104, 104, 104, - 104, 104, 104, 104, 58, 58, 264, 58, 263, 262, - 58, 66, 66, 259, 66, 258, 257, 66, 154, 154, - 154, 104, 104, 256, 104, 251, 250, 104, 194, 194, - 195, 195, 196, 196, 198, 198, 199, 199, 200, 200, - 205, 205, 215, 215, 216, 216, 217, 217, 240, 240, - - 242, 242, 244, 244, 246, 246, 253, 253, 255, 255, - 276, 276, 277, 277, 278, 278, 279, 279, 284, 284, - 285, 285, 300, 300, 301, 301, 302, 302, 303, 303, - 307, 307, 308, 308, 317, 317, 318, 318, 322, 322, - 329, 329, 330, 330, 334, 334, 338, 338, 339, 339, - 341, 341, 249, 238, 237, 236, 235, 234, 233, 232, - 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, - 219, 218, 213, 212, 211, 210, 209, 192, 191, 190, - 189, 188, 187, 180, 179, 178, 177, 176, 175, 174, - 173, 172, 171, 170, 165, 164, 163, 162, 161, 158, - - 155, 153, 149, 146, 143, 142, 136, 135, 130, 127, - 126, 125, 122, 119, 115, 110, 107, 103, 84, 68, - 67, 61, 57, 56, 343, 3, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343 - + 151, 151, 129, 93, 76, 70, 63, 72, 73, 65, + 348, 77, 94, 95, 85, 106, 112, 78, 107, 79, + + 79, 79, 86, 87, 96, 60, 78, 113, 79, 79, + 79, 81, 109, 346, 82, 110, 82, 114, 97, 80, + 81, 98, 115, 82, 130, 82, 83, 81, 88, 89, + 90, 59, 121, 82, 80, 122, 81, 343, 99, 100, + 117, 82, 82, 342, 101, 91, 118, 119, 124, 102, + 82, 125, 138, 83, 132, 132, 139, 139, 145, 82, + 146, 82, 152, 210, 152, 60, 92, 153, 153, 153, + 341, 133, 134, 140, 141, 74, 74, 74, 82, 157, + 158, 67, 74, 74, 74, 210, 82, 148, 149, 339, + 149, 160, 161, 138, 148, 149, 135, 149, 142, 134, + + 185, 141, 106, 148, 149, 107, 338, 168, 168, 149, + 148, 149, 59, 59, 186, 78, 149, 79, 79, 79, + 187, 183, 67, 188, 169, 170, 184, 195, 195, 81, + 264, 138, 82, 265, 82, 223, 224, 203, 337, 203, + 199, 199, 204, 204, 204, 81, 60, 60, 208, 171, + 210, 82, 170, 151, 151, 153, 153, 153, 106, 82, + 67, 107, 153, 153, 153, 209, 210, 209, 205, 334, + 205, 59, 210, 138, 333, 206, 332, 206, 217, 217, + 256, 256, 246, 246, 209, 242, 242, 205, 210, 138, + 106, 206, 209, 107, 331, 205, 206, 330, 106, 329, + + 106, 107, 67, 107, 327, 60, 59, 204, 204, 204, + 205, 326, 205, 325, 322, 209, 321, 209, 67, 59, + 244, 244, 244, 204, 204, 204, 251, 251, 251, 205, + 244, 244, 244, 244, 209, 320, 149, 205, 149, 319, + 60, 318, 209, 317, 244, 244, 244, 244, 244, 244, + 138, 316, 149, 60, 315, 312, 311, 149, 310, 248, + 248, 248, 309, 251, 251, 251, 304, 303, 302, 248, + 248, 248, 248, 301, 300, 250, 284, 250, 284, 67, + 251, 251, 251, 248, 248, 248, 248, 248, 248, 258, + 258, 258, 284, 299, 298, 297, 296, 284, 295, 258, + + 258, 258, 258, 294, 293, 292, 291, 288, 287, 106, + 286, 285, 107, 258, 258, 258, 258, 258, 258, 58, + 58, 58, 58, 58, 58, 58, 58, 66, 66, 279, + 66, 66, 66, 66, 66, 103, 103, 103, 103, 105, + 105, 105, 105, 105, 105, 105, 105, 58, 58, 278, + 58, 277, 276, 58, 66, 66, 275, 66, 274, 273, + 66, 155, 155, 155, 105, 105, 272, 105, 271, 270, + 105, 196, 196, 197, 197, 198, 198, 200, 200, 201, + 201, 202, 202, 207, 207, 218, 218, 219, 219, 220, + 220, 243, 243, 245, 245, 247, 247, 249, 249, 257, + + 257, 259, 259, 280, 280, 281, 281, 282, 282, 283, + 283, 289, 289, 290, 290, 305, 305, 306, 306, 307, + 307, 308, 308, 313, 313, 314, 314, 323, 323, 324, + 324, 328, 328, 335, 335, 336, 336, 340, 340, 344, + 344, 345, 345, 347, 347, 269, 268, 267, 266, 263, + 262, 261, 260, 255, 254, 253, 252, 241, 240, 239, + 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 222, 221, 216, 215, 214, 213, + 212, 211, 194, 193, 192, 191, 190, 189, 182, 181, + 180, 179, 178, 177, 176, 175, 174, 173, 172, 167, + + 166, 165, 164, 163, 162, 159, 156, 154, 150, 147, + 144, 143, 137, 136, 131, 128, 127, 126, 123, 120, + 116, 111, 108, 104, 84, 68, 67, 61, 57, 56, + 349, 3, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + + 349, 349, 349 } ; -static const flex_int16_t yy_chk[698] = +static const flex_int16_t yy_chk[704] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -4624,85 +4695,86 @@ static const flex_int16_t yy_chk[698] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 13, 14, 19, 22, 22, 22, 21, 23, 80, 80, 53, 30, 23, 19, 13, 21, 21, 14, - 335, 23, 30, 30, 28, 37, 41, 25, 37, 25, + 341, 23, 30, 30, 28, 37, 41, 25, 37, 25, 25, 25, 28, 28, 32, 10, 24, 41, 24, 24, - 24, 25, 39, 58, 25, 39, 25, 42, 32, 24, + 24, 25, 39, 337, 25, 39, 25, 42, 32, 24, 24, 32, 42, 24, 53, 24, 24, 25, 29, 29, - 29, 66, 46, 25, 24, 46, 24, 44, 32, 32, - 205, 25, 24, 44, 44, 29, 331, 58, 48, 32, - 24, 48, 243, 24, 60, 60, 67, 67, 303, 71, - 66, 71, 205, 74, 74, 74, 29, 86, 86, 95, - 95, 60, 60, 67, 67, 74, 74, 81, 74, 81, - 120, 243, 81, 81, 81, 120, 104, 303, 82, 104, - 82, 74, 74, 78, 78, 78, 60, 74, 67, 60, - - 79, 67, 79, 79, 79, 78, 78, 82, 78, 121, - 122, 105, 105, 122, 79, 82, 138, 79, 131, 79, - 239, 78, 78, 121, 328, 138, 138, 78, 105, 105, - 79, 223, 131, 131, 223, 147, 79, 147, 172, 172, - 147, 147, 147, 327, 79, 138, 150, 150, 151, 151, - 151, 326, 131, 105, 239, 301, 105, 152, 152, 152, - 154, 150, 321, 150, 166, 166, 197, 193, 320, 319, - 152, 203, 152, 203, 316, 197, 197, 154, 154, 154, - 150, 193, 193, 314, 166, 206, 152, 166, 150, 301, - 203, 152, 201, 201, 201, 197, 154, 313, 203, 252, - - 154, 193, 252, 312, 154, 195, 207, 206, 207, 208, - 308, 208, 311, 308, 208, 208, 208, 309, 306, 195, - 195, 195, 202, 202, 202, 207, 247, 247, 247, 195, - 195, 195, 195, 207, 305, 202, 304, 202, 294, 195, - 293, 214, 214, 195, 195, 195, 195, 195, 195, 199, - 292, 202, 291, 289, 288, 287, 202, 286, 199, 199, - 199, 214, 283, 282, 214, 281, 273, 272, 199, 199, - 199, 199, 270, 269, 268, 267, 266, 265, 199, 264, - 263, 262, 199, 199, 199, 199, 199, 199, 216, 216, - 216, 248, 248, 248, 261, 260, 259, 251, 216, 216, - - 216, 216, 250, 249, 248, 238, 248, 237, 216, 236, - 235, 216, 216, 216, 216, 216, 216, 216, 234, 233, - 248, 232, 230, 229, 228, 248, 344, 344, 344, 344, - 344, 344, 344, 344, 345, 345, 227, 345, 345, 345, - 345, 345, 346, 346, 346, 346, 347, 347, 347, 347, - 347, 347, 347, 347, 348, 348, 226, 348, 225, 224, - 348, 349, 349, 221, 349, 220, 219, 349, 350, 350, - 350, 351, 351, 218, 351, 213, 212, 351, 352, 352, - 353, 353, 354, 354, 355, 355, 356, 356, 357, 357, - 358, 358, 359, 359, 360, 360, 361, 361, 362, 362, - - 363, 363, 364, 364, 365, 365, 366, 366, 367, 367, - 368, 368, 369, 369, 370, 370, 371, 371, 372, 372, - 373, 373, 374, 374, 375, 375, 376, 376, 377, 377, - 378, 378, 379, 379, 380, 380, 381, 381, 382, 382, - 383, 383, 384, 384, 385, 385, 386, 386, 387, 387, - 388, 388, 211, 191, 190, 189, 188, 187, 186, 185, - 184, 183, 182, 181, 179, 178, 177, 176, 174, 173, - 171, 170, 164, 163, 162, 159, 157, 128, 127, 126, - 125, 124, 123, 119, 118, 117, 115, 114, 113, 112, - 111, 109, 108, 107, 103, 101, 100, 99, 97, 93, - - 85, 83, 77, 72, 70, 68, 65, 63, 57, 51, - 50, 49, 47, 45, 43, 40, 38, 36, 26, 18, - 15, 11, 9, 7, 3, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343 - + 29, 58, 46, 25, 24, 46, 24, 334, 32, 32, + 44, 25, 24, 333, 32, 29, 44, 44, 48, 32, + 24, 48, 66, 24, 60, 60, 67, 67, 71, 82, + 71, 82, 81, 207, 81, 58, 29, 81, 81, 81, + 332, 60, 60, 67, 67, 74, 74, 74, 82, 86, + 86, 66, 78, 78, 78, 207, 82, 74, 74, 327, + 74, 95, 95, 246, 78, 78, 60, 78, 67, 60, + + 122, 67, 105, 74, 74, 105, 326, 106, 106, 74, + 78, 78, 242, 132, 122, 79, 78, 79, 79, 79, + 123, 121, 246, 123, 106, 106, 121, 132, 132, 79, + 226, 139, 79, 226, 79, 174, 174, 148, 325, 148, + 139, 139, 148, 148, 148, 79, 242, 132, 155, 106, + 208, 79, 106, 151, 151, 152, 152, 152, 256, 79, + 139, 256, 153, 153, 153, 155, 155, 155, 151, 322, + 151, 195, 208, 199, 320, 153, 319, 153, 168, 168, + 217, 217, 199, 199, 155, 195, 195, 151, 155, 308, + 314, 153, 155, 314, 318, 151, 153, 317, 168, 315, + + 217, 168, 199, 217, 312, 195, 197, 203, 203, 203, + 205, 310, 205, 309, 299, 209, 298, 209, 308, 306, + 197, 197, 197, 204, 204, 204, 250, 250, 250, 205, + 197, 197, 197, 197, 209, 297, 204, 205, 204, 296, + 197, 294, 209, 293, 197, 197, 197, 197, 197, 197, + 201, 292, 204, 306, 291, 288, 287, 204, 286, 201, + 201, 201, 285, 251, 251, 251, 277, 276, 274, 201, + 201, 201, 201, 273, 272, 210, 251, 210, 251, 201, + 210, 210, 210, 201, 201, 201, 201, 201, 201, 219, + 219, 219, 251, 271, 270, 269, 268, 251, 267, 219, + + 219, 219, 219, 266, 265, 264, 263, 255, 254, 219, + 253, 252, 219, 219, 219, 219, 219, 219, 219, 350, + 350, 350, 350, 350, 350, 350, 350, 351, 351, 241, + 351, 351, 351, 351, 351, 352, 352, 352, 352, 353, + 353, 353, 353, 353, 353, 353, 353, 354, 354, 240, + 354, 239, 238, 354, 355, 355, 237, 355, 236, 235, + 355, 356, 356, 356, 357, 357, 233, 357, 232, 231, + 357, 358, 358, 359, 359, 360, 360, 361, 361, 362, + 362, 363, 363, 364, 364, 365, 365, 366, 366, 367, + 367, 368, 368, 369, 369, 370, 370, 371, 371, 372, + + 372, 373, 373, 374, 374, 375, 375, 376, 376, 377, + 377, 378, 378, 379, 379, 380, 380, 381, 381, 382, + 382, 383, 383, 384, 384, 385, 385, 386, 386, 387, + 387, 388, 388, 389, 389, 390, 390, 391, 391, 392, + 392, 393, 393, 394, 394, 230, 229, 228, 227, 224, + 223, 222, 221, 216, 215, 214, 213, 193, 192, 191, + 190, 189, 188, 187, 186, 185, 184, 183, 181, 180, + 179, 178, 176, 175, 173, 172, 166, 165, 164, 163, + 160, 158, 129, 128, 127, 126, 125, 124, 120, 119, + 118, 116, 115, 114, 113, 112, 110, 109, 108, 104, + + 102, 101, 100, 99, 97, 93, 85, 83, 77, 72, + 70, 68, 65, 63, 57, 51, 50, 49, 47, 45, + 43, 40, 38, 36, 26, 18, 15, 11, 9, 7, + 3, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, + + 349, 349, 349 } ; /* Table of booleans, true if rule could match eol. */ -static const flex_int32_t yy_rule_can_match_eol[115] = +static const flex_int32_t yy_rule_can_match_eol[116] = { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -4952,7 +5024,7 @@ void testLineNumPrint() yycolumn += yyleng; -#line 982 "chuck.yy.c" +#line 988 "chuck.yy.c" /* generate line number */ /* 1.5.0.7 (ge) added to remove dependecy on isatty() and unistd.h without the above option, flex/bison will check isatty() to determine @@ -4969,7 +5041,7 @@ void testLineNumPrint() /* universal character name */ /* thanks O'Reilly book for the above recipes for STRING_LIT / CHAR_LIT / FLOAT_VAL https://web.iitd.ac.in/~sumeet/flex__bison.pdf */ -#line 999 "chuck.yy.c" +#line 1005 "chuck.yy.c" #define INITIAL 0 @@ -5192,7 +5264,7 @@ YY_DECL ---------------------------------------------------------------*/ /* "<--" { char c; adjust(); comment_hack; continue; } */ /* ------------------------------------------------------------ */ -#line 1222 "chuck.yy.c" +#line 1228 "chuck.yy.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -5219,13 +5291,13 @@ YY_DECL 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 >= 344 ) + if ( yy_current_state >= 350 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_current_state != 343 ); + while ( yy_current_state != 349 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -5740,42 +5812,42 @@ YY_RULE_SETUP case 97: YY_RULE_SETUP #line 383 "chuck.lex" -{ adjust(); return ARROW_RIGHT; } +{ adjust(); return AT_IMPORT; } YY_BREAK case 98: YY_RULE_SETUP #line 384 "chuck.lex" -{ adjust(); return ARROW_LEFT; } +{ adjust(); return ARROW_RIGHT; } YY_BREAK case 99: YY_RULE_SETUP #line 385 "chuck.lex" -{ adjust(); return GRUCK_RIGHT; } +{ adjust(); return ARROW_LEFT; } YY_BREAK case 100: YY_RULE_SETUP #line 386 "chuck.lex" -{ adjust(); return GRUCK_LEFT; } +{ adjust(); return GRUCK_RIGHT; } YY_BREAK case 101: YY_RULE_SETUP #line 387 "chuck.lex" -{ adjust(); return UNGRUCK_RIGHT; } +{ adjust(); return GRUCK_LEFT; } YY_BREAK case 102: YY_RULE_SETUP #line 388 "chuck.lex" -{ adjust(); return UNGRUCK_LEFT; } +{ adjust(); return UNGRUCK_RIGHT; } YY_BREAK case 103: YY_RULE_SETUP -#line 390 "chuck.lex" -{ adjust(); yylval.sval=alloc_str(yytext); return ID; } +#line 389 "chuck.lex" +{ adjust(); return UNGRUCK_LEFT; } YY_BREAK case 104: YY_RULE_SETUP -#line 392 "chuck.lex" -{ adjust(); yylval.ival=atoi(yytext); return INT_VAL; } +#line 391 "chuck.lex" +{ adjust(); yylval.sval=alloc_str(yytext); return ID; } YY_BREAK case 105: YY_RULE_SETUP @@ -5785,12 +5857,12 @@ YY_RULE_SETUP case 106: YY_RULE_SETUP #line 394 "chuck.lex" -{ adjust(); yylval.ival=htol(yytext); return INT_VAL; } +{ adjust(); yylval.ival=atoi(yytext); return INT_VAL; } YY_BREAK case 107: YY_RULE_SETUP -#line 396 "chuck.lex" -{ adjust(); yylval.fval=atof(yytext); return FLOAT_VAL; } +#line 395 "chuck.lex" +{ adjust(); yylval.ival=htol(yytext); return INT_VAL; } YY_BREAK case 108: YY_RULE_SETUP @@ -5803,10 +5875,9 @@ YY_RULE_SETUP { adjust(); yylval.fval=atof(yytext); return FLOAT_VAL; } YY_BREAK case 110: -/* rule 110 can match eol */ YY_RULE_SETUP -#line 400 "chuck.lex" -{ adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return STRING_LIT; } +#line 399 "chuck.lex" +{ adjust(); yylval.fval=atof(yytext); return FLOAT_VAL; } YY_BREAK case 111: /* rule 111 can match eol */ @@ -5818,19 +5889,25 @@ case 112: /* rule 112 can match eol */ YY_RULE_SETUP #line 402 "chuck.lex" -{ adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return CHAR_LIT; } +{ adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return STRING_LIT; } YY_BREAK case 113: +/* rule 113 can match eol */ YY_RULE_SETUP -#line 404 "chuck.lex" -{ adjust(); EM_error( EM_tokPos, "illegal token" ); } +#line 403 "chuck.lex" +{ adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return CHAR_LIT; } YY_BREAK case 114: YY_RULE_SETUP -#line 406 "chuck.lex" +#line 405 "chuck.lex" +{ adjust(); EM_error( EM_tokPos, "illegal token" ); } + YY_BREAK +case 115: +YY_RULE_SETUP +#line 407 "chuck.lex" ECHO; YY_BREAK -#line 1860 "chuck.yy.c" +#line 1871 "chuck.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -6128,7 +6205,7 @@ static int yy_get_next_buffer (void) 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 >= 344 ) + if ( yy_current_state >= 350 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -6156,11 +6233,11 @@ static int yy_get_next_buffer (void) 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 >= 344 ) + if ( yy_current_state >= 350 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 343); + yy_is_jam = (yy_current_state == 349); return yy_is_jam ? 0 : yy_current_state; } @@ -6848,7 +6925,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 406 "chuck.lex" +#line 407 "chuck.lex" // older diff --git a/src/core/chuck_yacc.h b/src/core/chuck_yacc.h index 6e0cf444a..0d702474e 100644 --- a/src/core/chuck_yacc.h +++ b/src/core/chuck_yacc.h @@ -155,7 +155,8 @@ UNGRUCK_LEFT = 371, AT_OP = 372, AT_CTOR = 373, - AT_DTOR = 374 + AT_DTOR = 374, + AT_IMPORT = 375 }; #endif /* Tokens. */ @@ -276,6 +277,7 @@ #define AT_OP 372 #define AT_CTOR 373 #define AT_DTOR 374 +#define AT_IMPORT 375 @@ -307,9 +309,10 @@ typedef union YYSTYPE a_Complex complex_exp; a_Polar polar_exp; a_Vec vec_exp; // ge: added 1.3.5.3 + a_Import import; // 1.5.2.5 (ge) added } /* Line 1529 of yacc.c. */ -#line 313 "chuck.tab.h" +#line 316 "chuck.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 diff --git a/src/core/util_platforms.cpp b/src/core/util_platforms.cpp index f0034f688..9dbcbdd26 100644 --- a/src/core/util_platforms.cpp +++ b/src/core/util_platforms.cpp @@ -309,6 +309,20 @@ t_CKBOOL ck_isdir( const std::string & path ) +//----------------------------------------------------------------------------- +// name: ck_fileexists() +// desc: check if file exists +//----------------------------------------------------------------------------- +t_CKBOOL ck_fileexists( const std::string & path ) +{ + // shuttle + struct stat fs; + // stat the path; 0 means success + return ( stat( path.c_str(), &fs ) == 0 ); +} + + + #ifdef __PLATFORM_WINDOWS__ //----------------------------------------------------------------------------- // name: win32_getline() diff --git a/src/core/util_platforms.h b/src/core/util_platforms.h index 4a805e775..eac3e128b 100644 --- a/src/core/util_platforms.h +++ b/src/core/util_platforms.h @@ -48,6 +48,8 @@ FILE * ck_tmpfile(); // check if is dir t_CKBOOL ck_isdir( const std::string & path ); +// check if file exists +t_CKBOOL ck_fileexists( const std::string & path ); // do any platform-specific setup to enable ANSI escape codes t_CKBOOL ck_configANSI_ESCcodes(); diff --git a/src/core/util_string.cpp b/src/core/util_string.cpp index 086fc3d50..6345f4753 100644 --- a/src/core/util_string.cpp +++ b/src/core/util_string.cpp @@ -31,6 +31,7 @@ // date: Summer 2005 //----------------------------------------------------------------------------- #include "util_string.h" +#include "util_platforms.h" #include "chuck_errmsg.h" #ifdef __PLATFORM_WINDOWS__ @@ -403,7 +404,7 @@ t_CKBOOL extract_args( const string & token, // copy and trim string s = trim( token ); - // ignore second character as arg separator if its : on Windows + // ignore second character as arg separator if its : on Windows (e.g., for C:\) t_CKBOOL ignoreSecond = FALSE; #ifdef __PLATFORM_WINDOWS__ ignoreSecond = TRUE; @@ -413,6 +414,7 @@ t_CKBOOL extract_args( const string & token, t_CKBOOL scan = FALSE; t_CKBOOL ret = TRUE; t_CKBOOL ignoreNext = FALSE; + char * mask = NULL; for( i = 0; i < s.length(); i++ ) if( s[i] == '\\' ) @@ -476,8 +478,8 @@ t_CKBOOL extract_args( const string & token, continue; } - // look for : - if( !ignoreNext && s[i] == ':' && !(ignoreSecond && i == 1)) + // look for : (also test for windows drive letter, e.g., X:\ or X:/) + if( !ignoreNext && s[i] == ':' && !(ignoreSecond && i == 1 && s.length() > 2 && ( s[2] == '\\' || s[2] == '/' ) ) ) { // sanity if( i == 0 ) @@ -771,7 +773,7 @@ std::string get_full_path( const std::string & fp ) if( result == NULL && !extension_matches(fp, ".ck") ) result = realpath((fp + ".ck").c_str(), buf); - if(result == NULL) + if( result == NULL ) return fp; else return buf; @@ -786,6 +788,13 @@ std::string get_full_path( const std::string & fp ) DWORD result = GetFullPathNameA(fp.c_str(), MAX_PATH, buf, NULL); #endif + // if successful + if( result ) + { + // check if file exists; if not reset result + result = ck_fileexists( fp ) ? result : 0; + } + // try with .ck extension if( result == 0 && !extension_matches(fp, ".ck") ) { @@ -797,7 +806,7 @@ std::string get_full_path( const std::string & fp ) #endif } - if(result == 0) + if( result == 0 ) return fp; else return normalize_directory_separator(buf); @@ -884,6 +893,38 @@ std::string extract_filepath_file( const std::string & filepath ) +//----------------------------------------------------------------------------- +// name: transplant_filepath() +// desc: synthesize absolute path using existing filepath and incoming path +// EG: existing == "foo/bar.ck", incoming == "thing/poo.ck" => returns foo/thing/poo.ck +// NOTE: if incoming is detected as absolute path, incoming is returned without change +// (intended for use with import paths being relative to the file importing them) +//----------------------------------------------------------------------------- +std::string transplant_filepath( const std::string & existing, const std::string & incoming ) +{ + // expand e.g., ~ + std::string base = expand_filepath( existing ); + std::string inc = expand_filepath( incoming ); + std::string ret = ""; + + // check if already absolute path + if( is_absolute_path(inc) ) + { + // return inc + ret = inc; + } + else // if not absolute path + { + // generate absolute path relative to target that is importing it + ret = extract_filepath_dir(existing) + inc; + } + + // get_full_path() will also resolve symlinks . and .. + return get_full_path(ret); +} + + + //----------------------------------------------------------------------------- // file: dir_go_up() @@ -1159,6 +1200,29 @@ std::string autoFilename( const std::string & prefix, const std::string & fileEx +#ifdef WIN32 + #define stat _stat +#endif +//----------------------------------------------------------------------------- +// name: file_last_write_time() +// desc: unformatted last-write timestamp of a file | 1.5.3.5 (ge) +//----------------------------------------------------------------------------- +time_t file_last_write_time( const std::string & filename ) +{ + struct stat result; + if( stat( filename.c_str(), &result ) == 0 ) + { + // return result + return result.st_mtime; + } + + // stat encountered an error, e.g., couldn't open file + return 0; +} + + + + static t_CKBOOL str_contains( const string & s, char c ) { return s.find( c ) != string::npos; } diff --git a/src/core/util_string.h b/src/core/util_string.h index d00f1db7e..e5840c61e 100644 --- a/src/core/util_string.h +++ b/src/core/util_string.h @@ -37,6 +37,13 @@ #include #include #include +#include +#include +#ifndef WIN32 + #include +#endif + + // int to ascii @@ -103,6 +110,12 @@ std::string extract_filepath_dir( const std::string & filepath ); // get filename portion of a filepath (minus the directory portion) | 1.5.2.5 (ge) added std::string extract_filepath_file( const std::string & filepath ); +// desc: create absolute path using existing filepath and incoming path +// EG: existing == "foo/bar.ck", incoming == "thing/poo.ck" => returns foo/thing/poo.ck +// NOTE: if incoming is detected as absolute path, incoming is returned without change +// (intended for use with import paths being relative to the file importing them) +std::string transplant_filepath( const std::string & existing, const std::string & incoming ); + // convert \ to / (on Windows) std::string normalize_directory_separator( const std::string & filepath ); @@ -139,6 +152,9 @@ t_CKBOOL subdir_ok2recurse( const std::string & dirName, // get formatted timestamp of current system time; no new line std::string timestamp_formatted(); // e.g., "Sat Jun 24 04:18:42 2023" +// unformatted last-write timestamp of a file | 1.5.3.5 (ge) +time_t file_last_write_time( const std::string & filename ); + // tokenize a string into a vector of strings, by delimiters void tokenize( const std::string & str, std::vector & tokens, const std::string & delimiters ); diff --git a/src/host-web/chuck_emscripten.cpp b/src/host-web/chuck_emscripten.cpp index ced2af34a..7564fea0b 100644 --- a/src/host-web/chuck_emscripten.cpp +++ b/src/host-web/chuck_emscripten.cpp @@ -930,4 +930,16 @@ extern "C" return 0; } + // runtime import API (TBD) + t_CKBOOL EMSCRIPTEN_KEEPALIVE importModule( unsigned int chuckID, const char * path ) + { + // check + if( chuck_instances.count( chuckID ) > 0 ) + { + // call + // return chuck_instances[chuckID]->compiler()->loadModule( path ); + } + return FALSE; + } + } // extern "C" diff --git a/src/host-web/chuck_emscripten.h b/src/host-web/chuck_emscripten.h index 06815c23f..8888d8f63 100644 --- a/src/host-web/chuck_emscripten.h +++ b/src/host-web/chuck_emscripten.h @@ -113,4 +113,7 @@ extern "C" // get chuck time t_CKTIME EMSCRIPTEN_KEEPALIVE getChuckNow( unsigned int chuckID ); + // runtime import API (TDB) | 1.5.3.5 (ge) + t_CKBOOL EMSCRIPTEN_KEEPALIVE importModule( unsigned int chuckID, const char * path ); + } // extern "C" diff --git a/src/host-web/webchuck/js/webchuck_host.js b/src/host-web/webchuck/js/webchuck_host.js index bdb7e5700..59d75db2f 100644 --- a/src/host-web/webchuck/js/webchuck_host.js +++ b/src/host-web/webchuck/js/webchuck_host.js @@ -718,6 +718,17 @@ var createAChuck = function( chuckID, initPromise ) { self.port.postMessage( { type: 'clearGlobals' } ); } + // ================= chugin import API ====================== // + self.now = function( path ) + { + var callbackID = self.nextDeferID(); + self.port.postMessage( { + type: 'importChugin', + path: path, + callback: callbackID + } ); + return self.deferredPromises[callbackID]; + } })( aChuck ); diff --git a/src/test/07-Imports/.deps/01-A.ck b/src/test/07-Imports/.deps/01-A.ck new file mode 100644 index 000000000..f161f9f24 --- /dev/null +++ b/src/test/07-Imports/.deps/01-A.ck @@ -0,0 +1,5 @@ +public class A { + fun string a() { + return "a!"; + } +} diff --git a/src/test/07-Imports/.deps/02-A.ck b/src/test/07-Imports/.deps/02-A.ck new file mode 100644 index 000000000..5cb69333b --- /dev/null +++ b/src/test/07-Imports/.deps/02-A.ck @@ -0,0 +1,8 @@ +@import "02-B"; + +public class A { + fun string a() { + B b; + return b.b(); + } +} diff --git a/src/test/07-Imports/.deps/02-B.ck b/src/test/07-Imports/.deps/02-B.ck new file mode 100644 index 000000000..1ef5bf22f --- /dev/null +++ b/src/test/07-Imports/.deps/02-B.ck @@ -0,0 +1,5 @@ +public class B { + fun string b() { + return "b!"; + } +} diff --git a/src/test/07-Imports/.deps/03-A.ck b/src/test/07-Imports/.deps/03-A.ck new file mode 100644 index 000000000..39da9d683 --- /dev/null +++ b/src/test/07-Imports/.deps/03-A.ck @@ -0,0 +1,8 @@ +@import "03-B"; + +public class A { + fun string a() { + B b; + return B.b(); + } +} diff --git a/src/test/07-Imports/.deps/03-B.ck b/src/test/07-Imports/.deps/03-B.ck new file mode 100644 index 000000000..ff516b99b --- /dev/null +++ b/src/test/07-Imports/.deps/03-B.ck @@ -0,0 +1,8 @@ +@import "03-A"; + +public class B { + fun string b() { + A a; + return a.a(); + } +} diff --git a/src/test/07-Imports/.deps/04-A.ck b/src/test/07-Imports/.deps/04-A.ck new file mode 100644 index 000000000..ae63fea36 --- /dev/null +++ b/src/test/07-Imports/.deps/04-A.ck @@ -0,0 +1 @@ +@import "04-B"; diff --git a/src/test/07-Imports/.deps/04-B.ck b/src/test/07-Imports/.deps/04-B.ck new file mode 100644 index 000000000..eea040dd9 --- /dev/null +++ b/src/test/07-Imports/.deps/04-B.ck @@ -0,0 +1 @@ +@import "04-C"; diff --git a/src/test/07-Imports/.deps/04-C.ck b/src/test/07-Imports/.deps/04-C.ck new file mode 100644 index 000000000..10a611acb --- /dev/null +++ b/src/test/07-Imports/.deps/04-C.ck @@ -0,0 +1 @@ +@import "04-A"; diff --git a/src/test/07-Imports/.deps/05-A.ck b/src/test/07-Imports/.deps/05-A.ck new file mode 100644 index 000000000..bf47dd06a --- /dev/null +++ b/src/test/07-Imports/.deps/05-A.ck @@ -0,0 +1,8 @@ +@import "05-C"; + +public class A { + fun string a() { + C c; + return c.c(); + } +} diff --git a/src/test/07-Imports/.deps/05-B.ck b/src/test/07-Imports/.deps/05-B.ck new file mode 100644 index 000000000..7c47a7e19 --- /dev/null +++ b/src/test/07-Imports/.deps/05-B.ck @@ -0,0 +1,8 @@ +@import "05-C"; + +public class B { + fun string b() { + C c; + return c.c(); + } +} diff --git a/src/test/07-Imports/.deps/05-C.ck b/src/test/07-Imports/.deps/05-C.ck new file mode 100644 index 000000000..c91c5913b --- /dev/null +++ b/src/test/07-Imports/.deps/05-C.ck @@ -0,0 +1,5 @@ +public class C { + fun string c() { + return "c!"; + } +} diff --git a/src/test/07-Imports/.deps/Foo.ck b/src/test/07-Imports/.deps/Foo.ck new file mode 100644 index 000000000..c70acc819 --- /dev/null +++ b/src/test/07-Imports/.deps/Foo.ck @@ -0,0 +1,13 @@ +// let's say we define a custom class... +public class Foo { int num; } + +// persistent operator overloading (transcends file contexts) +// NOTE the use of 'public' instead of 'fun' -- it's fun for all! +// define binary operator overload for '+' +public Foo @operator +( Foo lhs, Foo rhs ) +{ Foo retval; lhs.num + rhs.num => retval.num; return retval; } + +// LOCAL binary operator overload for '=>' (local to this context) +fun void @operator =^( Foo lhs, Foo rhs ) +{ <<< lhs.num, "=^", rhs.num >>>; } + diff --git a/src/test/07-Imports/01.ck b/src/test/07-Imports/01.ck new file mode 100644 index 000000000..eb6f3f41b --- /dev/null +++ b/src/test/07-Imports/01.ck @@ -0,0 +1,5 @@ +@import ".deps/01-A"; + +A a; + +if (a.a() == "a!") <<< "success" >>>; \ No newline at end of file diff --git a/src/test/07-Imports/02.ck b/src/test/07-Imports/02.ck new file mode 100644 index 000000000..13fa18cc5 --- /dev/null +++ b/src/test/07-Imports/02.ck @@ -0,0 +1,5 @@ +@import ".deps/02-A"; + +A a; + +if (a.a() == "b!") <<< "success" >>>; \ No newline at end of file diff --git a/src/test/07-Imports/03.ck b/src/test/07-Imports/03.ck new file mode 100644 index 000000000..ab3bfe78c --- /dev/null +++ b/src/test/07-Imports/03.ck @@ -0,0 +1,6 @@ +// A and B or co-dependent. This should not compile +@import ".deps/03-A" +@import ".deps/03-B" + +// shouldn't get here +<<< "aaaaahhhhhh" >>>; diff --git a/src/test/07-Imports/03.txt b/src/test/07-Imports/03.txt new file mode 100644 index 000000000..749d6498a --- /dev/null +++ b/src/test/07-Imports/03.txt @@ -0,0 +1,5 @@ +[chuck]: @import error -- cycle detected: +[chuck]: |- '03-A.ck' is imported from... +[chuck]: |- '03-B.ck':[line 1], which is imported from... +[chuck]: |- '03-A.ck':[line 1], which is imported from... +[chuck]: |- '03.ck':[line 2] (this is the originating file) diff --git a/src/test/07-Imports/04.ck b/src/test/07-Imports/04.ck new file mode 100644 index 000000000..4d2525e7d --- /dev/null +++ b/src/test/07-Imports/04.ck @@ -0,0 +1,5 @@ +@import ".deps/04-A"; + +// Tests a longer cycle (A -> B -> C -> A) + +<<< "aaaaahhhhhh" >>>; \ No newline at end of file diff --git a/src/test/07-Imports/04.txt b/src/test/07-Imports/04.txt new file mode 100644 index 000000000..69d53c1e0 --- /dev/null +++ b/src/test/07-Imports/04.txt @@ -0,0 +1,6 @@ +[chuck]: @import error -- cycle detected: +[chuck]: |- '04-A.ck' is imported from... +[chuck]: |- '04-C.ck':[line 1], which is imported from... +[chuck]: |- '04-B.ck':[line 1], which is imported from... +[chuck]: |- '04-A.ck':[line 1], which is imported from... +[chuck]: |- '04.ck':[line 1] (this is the originating file) diff --git a/src/test/07-Imports/05.ck b/src/test/07-Imports/05.ck new file mode 100644 index 000000000..1b9de8606 --- /dev/null +++ b/src/test/07-Imports/05.ck @@ -0,0 +1,8 @@ +// Both A and B depend on C +@import ".deps/05-A"; +@import ".deps/05-B"; + +A a; +B b; + +if (a.a() == "c!" && b.b() == "c!") <<< "success" >>>; \ No newline at end of file diff --git a/src/test/07-Imports/06-error-no-such.ck b/src/test/07-Imports/06-error-no-such.ck new file mode 100644 index 000000000..bee080162 --- /dev/null +++ b/src/test/07-Imports/06-error-no-such.ck @@ -0,0 +1,2 @@ +// test import file that doesn't exist +@import "no-such-file.ck" diff --git a/src/test/07-Imports/06-error-no-such.txt b/src/test/07-Imports/06-error-no-such.txt new file mode 100644 index 000000000..e7e69d76e --- /dev/null +++ b/src/test/07-Imports/06-error-no-such.txt @@ -0,0 +1,3 @@ +06-error-no-such.ck:2:9: error: no such file: 'no-such-file.ck' +[2] @import "no-such-file.ck" + ^ diff --git a/src/test/07-Imports/07-error-self-import.ck b/src/test/07-Imports/07-error-self-import.ck new file mode 100644 index 000000000..dbc6a72ea --- /dev/null +++ b/src/test/07-Imports/07-error-self-import.ck @@ -0,0 +1 @@ +@import "07-error-self-import.ck" diff --git a/src/test/07-Imports/07-error-self-import.txt b/src/test/07-Imports/07-error-self-import.txt new file mode 100644 index 000000000..b073aebe7 --- /dev/null +++ b/src/test/07-Imports/07-error-self-import.txt @@ -0,0 +1,3 @@ +[chuck]: @import error -- cycle detected: +[chuck]: |- '07-error-self-import.ck' is imported from... +[chuck]: |- '07-error-self-import.ck':[line 1] (this is the originating file) diff --git a/src/test/07-Imports/08-operator.ck b/src/test/07-Imports/08-operator.ck new file mode 100644 index 000000000..c9d51f903 --- /dev/null +++ b/src/test/07-Imports/08-operator.ck @@ -0,0 +1,7 @@ +@import ".deps/Foo.ck" + +Foo a, b; +1 => a.num; +2 => b.num; + +if( (a + b).num == 3 ) <<< "success" >>>; diff --git a/src/test/07-Imports/09-error-opeartor.ck b/src/test/07-Imports/09-error-opeartor.ck new file mode 100644 index 000000000..3ce0adc5d --- /dev/null +++ b/src/test/07-Imports/09-error-opeartor.ck @@ -0,0 +1,8 @@ +// error case: test using an operator local to Foo.ck +@import ".deps/Foo.ck" + +// make a Foo +Foo a, b; + +// this should throw an error +a =^ b; \ No newline at end of file diff --git a/src/test/07-Imports/09-error-opeartor.txt b/src/test/07-Imports/09-error-opeartor.txt new file mode 100644 index 000000000..3e24bfaec --- /dev/null +++ b/src/test/07-Imports/09-error-opeartor.txt @@ -0,0 +1,3 @@ +09-error-opeartor.ck:8:3: error: cannot resolve operator '=^' on types 'Foo' and 'Foo' +[8] a =^ b; + ^