示例#1
0
int32
_Interpret_Do_CombinatorLeftParen ( )
{
    Context * cntx = _Context_ ;
    Compiler * compiler = cntx->Compiler0 ;
    int32 svcm = GetState ( compiler, COMPILE_MODE ), svclps = GetState ( compiler, C_COMBINATOR_LPAREN ) ;
    int32 blocksParsed = 0 ;
    byte * token ;

    SetState ( compiler, C_COMBINATOR_LPAREN, true ) ;
    SetState ( compiler, PREFIX_PARSING, true ) ;
    while ( 1 )
    {
        token = _Lexer_ReadToken ( cntx->Lexer0, 0 ) ;
        if ( String_Equal ( ( char* ) token, ";" ) )
        {
            CfrTil_EndBlock ( ) ;
            CfrTil_BeginBlock ( ) ;
            blocksParsed ++ ;
            continue ;
        }
        if ( String_Equal ( ( char* ) token, ")" ) )
        {
            byte * token1 = Lexer_PeekNextNonDebugTokenWord ( cntx->Lexer0 ) ;
            if ( String_Equal ( token1, "{" ) )
            {
                //_Lexer_NextNonDebugTokenWord ( cntx->Lexer0 ) ; // actually get token1 = "{"
                CfrTil_EndBlock ( ) ;
                //CfrTil_BeginBlock ( ) ; // callee handles this
                blocksParsed ++ ;
                break ;
            }
            else
            {
                token = _Lexer_ReadToken ( cntx->Lexer0, 0 ) ; // drop the ")" ?!? must be a better way than this ?!?
                continue ;
            }
        }
        Interpreter_InterpretAToken ( cntx->Interpreter0, token, - 1 ) ;
        if ( ( blocksParsed == 0 ) && ( cntx->CurrentlyRunningWord->CProperty & LITERAL ) && ( ! Is_LValue ( cntx->Interpreter0->w_Word ) ) ) //GetState ( cntx, C_LHS ) )
        {
            // setup for optimization if this literal constant is the loop conditional
            BlockInfo * bi = ( BlockInfo* ) _Stack_Top ( compiler->BlockStack ) ;
            bi->LiteralWord = cntx->CurrentlyRunningWord ;
        }
    }
    SetState ( compiler, COMPILE_MODE, svcm ) ;
    SetState ( compiler, C_COMBINATOR_LPAREN, svclps ) ;
    //SetState ( compiler, PREFIX_ARG_PARSING, false ) ;
    SetState ( compiler, PREFIX_PARSING, false ) ;
    return blocksParsed ;
}
示例#2
0
void
_Compiler_Setup_BI_tttn ( Compiler * compiler, int32 ttt, int32 negFlag )
{
    BlockInfo *bi = ( BlockInfo * ) _Stack_Top ( compiler->CombinatorBlockInfoStack ) ;
    BlockInfo_Set_tttn ( bi, ttt, negFlag ) ;
}