Beispiel #1
0
static HRESULT EnumeratorConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
        jsval_t *r)
{
    jsdisp_t *obj;
    HRESULT hres;

    TRACE("\n");

    switch(flags) {
    case DISPATCH_CONSTRUCT: {
        if (argc > 1)
            return throw_syntax_error(ctx, JS_E_INVALIDARG, NULL);

        hres = create_enumerator(ctx, (argc == 1) ? &argv[0] : 0, &obj);
        if(FAILED(hres))
            return hres;

        *r = jsval_obj(obj);
        break;
    }
    default:
        FIXME("unimplemented flags: %x\n", flags);
        return E_NOTIMPL;
    }

    return S_OK;
}
Beispiel #2
0
Token Lexer::get_expected_token(TokenType tt)
{
    TokenType p = peek_token().type;
    if (p != tt) {
        string msg = S("expected ") + tokentype2str(tt);
        throw_syntax_error(p == kTokenNop ? msg
                                    : msg + " instead of " + tokentype2str(p));
    }
    return get_token();
}
Beispiel #3
0
Token Lexer::get_expected_token(const string& raw1, const string& raw2)
{
    TokenType p = peek_token().type;
    string s = peek_token().as_string();
    if (s != raw1 && s != raw2) {
        string msg = "expected `" + raw1 + "' or `" + raw2 + "'";
        throw_syntax_error(p == kTokenNop ? msg
                                          : msg + " instead of `" + s + "'");
    }
    return get_token();
}
Beispiel #4
0
Token Lexer::get_expected_token(TokenType tt, const string& raw)
{
    TokenType p = peek_token().type;
    string s = peek_token().as_string();
    if (p != tt && s != raw) {
        string msg = S("expected ") + tokentype2str(tt) + " or `" + raw + "'";
        throw_syntax_error(p == kTokenNop ? msg
                                          : msg + " instead of `" + s + "'");
    }
    return get_token();
}
 void AbortErrorPolicy::handle_body_section_error(ParsingState & state, std::string message)
 {
     state.m_is_valid = false;
     throw_syntax_error("Line " + std::to_string(state.n_lines) + ": " + message);
 }