Word * Finder_FindQualifiedIDWord ( Finder * finder, byte * token ) { Word * word ; //while ( ( symbol = _Symbol_FindAny ( token ) ) ) while ( ( word = Finder_Word_FindUsing ( finder, token ) ) ) { if ( word->CType & ( NAMESPACE ) ) { Namespace * ns = ( Namespace * ) word ; Finder_SetQualifyingNamespace ( finder, ns ) ; } else if ( word->CType & ( OBJECT ) ) { Finder_SetQualifyingNamespace ( finder, word->ContainingNamespace ) ; } else if ( word->CType & ( CLASS_MEMBER_ACCESS ) ) { Finder_SetQualifyingNamespace ( finder, word->ClassFieldNamespace ) ; } else return word ; if ( Lexer_IsTokenForwardDotted ( _Context_->Lexer0 ) ) { Lexer_ReadToken ( _Context_->Lexer0 ) ; // the '.' token = Lexer_ReadToken ( _Context_->Lexer0 ) ; // the namespace continue ; } else return word ; } return 0 ; }
void _CompileFromName_Inline ( byte * wordName ) { Word * word = Finder_Word_FindUsing ( _Context_->Finder0, wordName, 0 ) ; if ( ! word ) _Throw ( QUIT ) ; _Compile_WordInline ( word ) ; }
void _CompileFromName ( byte * wordName ) { Word * word = Finder_Word_FindUsing ( _Context_->Finder0, wordName, 0 ) ; // ?? Exception : error message here if ( ! word ) _Throw ( QUIT ) ; _Word_Compile ( word ) ; }
Word * Finder_FindToken_WithException ( Finder * finder, byte * token ) { if ( Finder_Word_FindUsing ( finder, token ) == 0 ) { Printf ( ( byte* ) "\n%s ?", ( char* ) token ) ; CfrTil_Using ( ) ; CfrTil_Exception ( NOT_A_KNOWN_OBJECT, QUIT ) ; } return finder->w_Word ; }
byte * Finder_GetTokenDefinitionAddress ( Finder * finder, byte * token ) { byte * definitionAddress = 0 ; if ( token ) { Word * word = Finder_Word_FindUsing ( finder, token ) ; if ( word ) definitionAddress = ( byte* ) word->Definition ; } return definitionAddress ; }
void CfrTil_DebugOn ( ) { Context * cntx = _Context_ ; Debugger * debugger = _Debugger_ ; debugger->DebugESP = 0 ; _Debugger_Init ( debugger, 0, 0 ) ; //debugger->SaveCpuState ( ) ; SetState ( _Q_->OVT_CfrTil, DEBUG_MODE, true ) ; byte * nextToken = Lexer_PeekNextNonDebugTokenWord ( cntx->Lexer0 ) ; debugger->EntryWord = Finder_Word_FindUsing ( cntx->Interpreter0->Finder0, nextToken, 0 ) ; SetState ( _Debugger_, DBG_PRE_DONE | DBG_INTERPRET_LOOP_DONE | DBG_AUTO_MODE, false ) ; debugger->StartHere = 0 ; debugger->LastSetupWord = 0 ; SetState ( debugger, DBG_MENU, true ) ; DebugShow_ON ; }
void CfrTil_IncDec ( int32 op ) // + { Context * cntx = _Context_ ; Compiler * compiler = cntx->Compiler0 ; if ( ! GetState ( compiler, LC_CFRTIL ) ) { Word * currentWord = _Context_->CurrentlyRunningWord ; byte * nextToken = Lexer_PeekNextNonDebugTokenWord ( cntx->Lexer0 ) ; Word * nextWord = Finder_Word_FindUsing ( cntx->Interpreter0->Finder0, nextToken, 0 ) ; int32 sd = List_Depth ( compiler->WordList ) ; Word *one = ( Word* ) Compiler_WordList ( 1 ) ; // the operand SetState ( _Debugger_, DEBUG_SHTL_OFF, true ) ; if ( nextWord && ( nextWord->CProperty & ( CATEGORY_OP_ORDERED | CATEGORY_OP_UNORDERED | CATEGORY_OP_DIVIDE | CATEGORY_OP_EQUAL ) ) ) // postfix { List_DropN ( compiler->WordList, 1 ) ; // the operator; let higher level see the variable Interpreter_InterpretNextToken ( cntx->Interpreter0 ) ; if ( GetState ( compiler, C_INFIX_EQUAL ) && GetState ( _Q_->OVT_CfrTil, OPTIMIZE_ON ) && CompileMode ) { dllist * postfixList = List_New ( ) ; List_Push_1Value_Node ( postfixList, currentWord ) ; List_Push_1Value_Node ( postfixList, one ) ; List_Push_1Value_Node ( compiler->PostfixLists, postfixList ) ; return ; } else { if ( sd > 1 ) { _Interpreter_DoWord ( cntx->Interpreter0, one, - 1 ) ; _Interpreter_DoWord ( cntx->Interpreter0, currentWord, - 1 ) ; return ; } } } else if ( ( sd > 1 ) && ( one->CProperty & ( PARAMETER_VARIABLE | LOCAL_VARIABLE | NAMESPACE_VARIABLE ) ) ) ; // postfix else if ( nextWord && ( nextWord->CProperty & ( PARAMETER_VARIABLE | LOCAL_VARIABLE | NAMESPACE_VARIABLE ) ) ) // prefix { List_DropN ( compiler->WordList, 1 ) ; // the operator; let higher level see the variable _Interpreter_DoWord ( cntx->Interpreter0, nextWord, -1 ) ; _Compiler_CopyDuplicates ( compiler, currentWord ) ; // the operator } else { if ( GetState ( compiler, C_INFIX_EQUAL ) ) { int32 i ; Word * word ; dllist * postfixList = List_New ( ) ; List_Push_1Value_Node ( postfixList, currentWord ) ; // remember : this will be lifo for ( i = 1 ; word = Compiler_WordList ( i ), ( word->CProperty & ( CATEGORY_OP_ORDERED | CATEGORY_OP_UNORDERED | CATEGORY_OP_DIVIDE | CATEGORY_OP_EQUAL ) ) ; i ++ ) ; List_Push_1Value_Node ( postfixList, Compiler_WordList ( i ) ) ; List_Push_1Value_Node ( compiler->PostfixLists, postfixList ) ; List_DropN ( compiler->WordList, 1 ) ; // the operator; let higher level see the variable for optimization return ; } } } _CfrTil_Do_IncDec ( op ) ; SetState ( _Debugger_, DEBUG_SHTL_OFF, false ) ; }
void CfrTil_Postfix_Find ( ) { Word * word = Finder_Word_FindUsing ( _Context_->Finder0, ( byte* ) _DataStack_Pop ( ) ) ; _DataStack_Push ( ( int32 ) word ) ; }
Word * _CfrTil_Token_FindUsing ( byte * token ) { return Finder_Word_FindUsing ( _Context_->Finder0, token ) ; }