Beispiel #1
0
    public static Int32 Parse(List<Token> src, Int32 begin, out CompoundStmt stmt)
    {
        stmt = null;
        if (!Parser.IsLCURL(src[begin])) {
            return -1;
        }
        Int32 current = begin + 1;

        List<Decln> decl_list;
        Int32 saved = current;
        current = _declaration_list.Parse(src, current, out decl_list);
        if (current == -1) {
            decl_list = new List<Decln>();
            current = saved;
        }

        List<Stmt> stmt_list;
        saved = current;
        current = _statement_list.Parse(src, current, out stmt_list);
        if (current == -1) {
            stmt_list = new List<Stmt>();
            current = saved;
        }

        if (!Parser.IsRCURL(src[current])) {
            return -1;
        }
        current++;

        stmt = new CompoundStmt(decl_list, stmt_list);
        return current;
    }
 public FuncDef(DeclnSpecs specs, Declr declr, CompoundStmt stmt)
 {
     this.specs = specs;
     this.declr = declr;
     this.stmt = stmt;
 }