Beispiel #1
0
AST_Dict* read_dict(BufferedReader *reader) {
    AST_Dict *rtn = new AST_Dict();

    rtn->col_offset = readColOffset(reader);
    readExprVector(rtn->keys, reader);
    rtn->lineno = reader->readULL();
    readExprVector(rtn->values, reader);

    assert(rtn->keys.size() == rtn->values.size());
    return rtn;
}
Beispiel #2
0
AST_ClassDef* read_classdef(BufferedReader *reader) {
    AST_ClassDef *rtn = new AST_ClassDef();

    readExprVector(rtn->bases, reader);
    readStmtVector(rtn->body, reader);
    rtn->col_offset = readColOffset(reader);
    readExprVector(rtn->decorator_list, reader);
    rtn->lineno = reader->readULL();
    rtn->name = readString(reader);

    return rtn;
}
Beispiel #3
0
AST_arguments* read_arguments(BufferedReader* reader) {
    if (VERBOSITY("parsing") >= 2)
        printf("reading arguments\n");
    AST_arguments* rtn = new AST_arguments();

    readExprVector(rtn->args, reader);
    rtn->col_offset = -1;
    readExprVector(rtn->defaults, reader);
    rtn->kwarg = readString(reader);
    rtn->lineno = -1;
    rtn->vararg = readString(reader);
    return rtn;
}
Beispiel #4
0
AST_ExtSlice* read_extslice(BufferedReader* reader) {
    AST_ExtSlice* rtn = new AST_ExtSlice();

    rtn->col_offset = -1;
    rtn->lineno = -1;
    readExprVector(rtn->dims, reader);
    return rtn;
}
Beispiel #5
0
AST_List* read_list(BufferedReader *reader) {
    AST_List *rtn = new AST_List();

    rtn->col_offset = readColOffset(reader);
    rtn->ctx_type = (AST_TYPE::AST_TYPE)reader->readByte();
    readExprVector(rtn->elts, reader);
    rtn->lineno = reader->readULL();
    return rtn;
}
Beispiel #6
0
AST_Assign* read_assign(BufferedReader *reader) {
    AST_Assign *rtn = new AST_Assign();

    rtn->col_offset = readColOffset(reader);
    rtn->lineno = reader->readULL();
    readExprVector(rtn->targets, reader);
    rtn->value = readASTExpr(reader);
    return rtn;
}
Beispiel #7
0
AST_Delete* read_delete(BufferedReader* reader) {
    AST_Delete* rtn = new AST_Delete();

    rtn->col_offset = readColOffset(reader);
    rtn->lineno = reader->readULL();
    readExprVector(rtn->targets, reader);

    return rtn;
}
Beispiel #8
0
AST_Set* read_set(BufferedReader* reader) {
    AST_Set* rtn = new AST_Set();

    rtn->col_offset = readColOffset(reader);
    readExprVector(rtn->elts, reader);
    rtn->lineno = reader->readULL();

    return rtn;
}
Beispiel #9
0
AST_Print* read_print(BufferedReader *reader) {
    AST_Print *rtn = new AST_Print();

    rtn->col_offset = readColOffset(reader);
    rtn->dest = readASTExpr(reader);
    rtn->lineno = reader->readULL();
    rtn->nl = reader->readByte();
    readExprVector(rtn->values, reader);
    return rtn;
}
Beispiel #10
0
AST_expr* read_boolop(BufferedReader *reader) {
    AST_BoolOp *rtn = new AST_BoolOp();

    rtn->col_offset = readColOffset(reader);
    rtn->lineno = reader->readULL();
    rtn->op_type = (AST_TYPE::AST_TYPE)reader->readByte();
    readExprVector(rtn->values, reader);

    return rtn;
}
Beispiel #11
0
AST_comprehension* read_comprehension(BufferedReader *reader) {
    AST_comprehension *rtn = new AST_comprehension();

    readExprVector(rtn->ifs, reader);
    rtn->iter = readASTExpr(reader);
    rtn->target = readASTExpr(reader);

    rtn->col_offset = -1;
    rtn->lineno = -1;

    return rtn;
}
Beispiel #12
0
AST_FunctionDef* read_functiondef(BufferedReader *reader) {
    if (VERBOSITY("parsing") >= 2)
        printf("reading functiondef\n");
    AST_FunctionDef *rtn = new AST_FunctionDef();

    rtn->args = static_cast<AST_arguments*>(readASTMisc(reader));
    readStmtVector(rtn->body, reader);
    rtn->col_offset = readColOffset(reader);
    readExprVector(rtn->decorator_list, reader);
    rtn->lineno = reader->readULL();
    rtn->name = readString(reader);
    return rtn;
}
Beispiel #13
0
AST_Call* read_call(BufferedReader *reader) {
    AST_Call *rtn = new AST_Call();

    readExprVector(rtn->args, reader);
    rtn->col_offset = readColOffset(reader);
    rtn->func = readASTExpr(reader);

    readMiscVector(rtn->keywords, reader);

    rtn->kwargs = readASTExpr(reader);
    rtn->lineno = reader->readULL();
    rtn->starargs = readASTExpr(reader);
    return rtn;
}
Beispiel #14
0
AST_expr* read_compare(BufferedReader *reader) {
    AST_Compare *rtn = new AST_Compare();

    rtn->col_offset = readColOffset(reader);
    readExprVector(rtn->comparators, reader);
    rtn->left = readASTExpr(reader);
    rtn->lineno = reader->readULL();

    int num_ops = reader->readShort();
    assert(num_ops == rtn->comparators.size());
    for (int i = 0; i < num_ops; i++) {
        rtn->ops.push_back((AST_TYPE::AST_TYPE)reader->readByte());
    }

    return rtn;
}