Exemplo n.º 1
0
        public override AST_Node VisitCaseof([NotNull] CoolParser.CaseofContext context)
        {
            var exp = (AST_Expresion)Visit(context.expr());
            List <AST_ClassProperty> props = new List <AST_ClassProperty>();

            foreach (var item in context.branch())
            {
                var s = new AST_FormalDec(item.formal(), new AST_Id(item.formal().ID(), item.formal().ID().GetText()),
                                          new AST_Type_Node(item.formal().TYPE(), item.formal().TYPE().GetText()));
                AST_ClassProperty x = new AST_ClassProperty(item, s, (AST_Expresion)Visit(item.expr()));
                props.Add(x);
            }

            return(new AST_CaseOf(context, new AST_ListProp(context, props), exp));
        }