Exemplo n.º 1
0
 internal OR(Node lhs, Node rhs, YYLTYPE location)
     : base(location)
 {
     Debug.Assert(lhs != null && rhs != null);
     this.lhs = lhs;
     this.rhs = rhs;
 }
Exemplo n.º 2
0
        protected Node _else;        // optional

        internal COND(Node cond, Node body, Node _else, YYLTYPE location)
            : base(location)
        {
            Debug.Assert(cond != null);
            this.cond = cond;
            this.body = body;
            this._else = _else;
        }
Exemplo n.º 3
0
 internal ARRAY(Node args, YYLTYPE location)
     : base(location)
 {
     if (args is ARGS)
         this.args = (ARGS)args;
     else
         this.args = new ARGS(args, null, null, null, args.location, false);
 }
Exemplo n.º 4
0
 internal ARGS(Node parameters, Node hashlist, Node array, Node block, YYLTYPE location, bool parens): base(location)
 {
     this.parameters = parameters;
     this.hashlist = hashlist;
     this.array = array;
     this.block = block;
     this.parens = parens;
 }
Exemplo n.º 5
0
 internal FORMALS(Node normal, Node optional, Node rest, Node block, YYLTYPE location)
     : base(location)
 {
     this.normal = (StaticLocalVar)normal;
     this.optional = (ASSIGNMENT)optional;
     this.rest = (StaticLocalVar)rest;
     this.block = (StaticLocalVar)block;
 }
Exemplo n.º 6
0
 internal StringTerminator(int func, int term, int paren, int name, YYLTYPE location): base(location)
 {
     this.func = func;
     this.term = term;
     this.paren = paren;
     this.name = name;
     this.nest = 0;
 }
Exemplo n.º 7
0
 internal ARGS(YYLTYPE location, bool parens): base(location)
 {
     this.parameters = null;
     this.hashlist = null;
     this.array = null;
     this.block = null;
     this.parens = parens;
 }
Exemplo n.º 8
0
        internal override VAR create_local_here(string id, YYLTYPE location)
        {
            if (frame.dynamic_vars == null)
                frame.dynamic_vars = new Dictionary<string, object>();

            if (!frame.dynamic_vars.ContainsKey(id))
                frame.dynamic_vars.Add(id, null);

            return new DynamicLocalVar(id, this, location);
        }
Exemplo n.º 9
0
        internal TRY_BLOCK(Scope parent_scope, Node body, Node rescue, Node _else, Node ensure, YYLTYPE location)
            : base(location)
        {
            this.parent_scope = parent_scope;
            this.body = body;
            this.rescue = (RESCUE_CLAUSE)rescue;
            this._else = _else;
            this.ensure = ensure;

        }
Exemplo n.º 10
0
 internal CALL(Node args, YYLTYPE location)
     : base(location)
 {
     if (args == null)
         this.args = null;
     else if (args is ListGen)
         this.args = (ListGen)args;
     else
         this.args = new ARGS(args, null, null, null, location, false);
 }
Exemplo n.º 11
0
        internal CONCAT(Node A, Node B, YYLTYPE location)
            : base(location)
        {
            if (A == null || A is VALUE && ((string)((VALUE)A).value) == "")
            {
                this.head = B;
                return;
            }

            Node headA, headB;
            if (A is CONCAT)
                headA = ((CONCAT)A).head;
            else
                headA = A;

            if (B is CONCAT)
                headB = ((CONCAT)B).head;
            else
                headB = B;

            this.head = Parser.append(headA, headB);
        }
Exemplo n.º 12
0
        internal ControlFlowNode(Scope parent_scope, ARGS return_val, YYLTYPE location)
            : base(location)
        {
            this.parent_scope = parent_scope;

            // no return value
            if (return_val == null)
                return;
 
            if (return_val.block != null)
                throw new System.Exception("block argument should not be given");

            // just a single value => return that value
            if (return_val.hashlist == null && return_val.array == null && return_val.parameters.nd_next == null)
            {
                this.return_val = return_val.parameters;
                return;
            }

            // just hash values => return a HASH
            if (return_val.parameters == null && return_val.array == null)
            {
                this.return_val = new HASH(return_val.hashlist, return_val.location);
                return;
            }

            // return *p => if p is an ARRAY then ... else ...
            if (return_val.parameters == null && return_val.hashlist == null)
            {
                this.array = return_val.array;
                this.return_val = new ProxyNode(ReturnArray, return_val.location);
            }
            else
            {
                this.args = return_val;
                this.return_val = new ProxyNode(ReturnRubyArray, return_val.location);
            }
        }
Exemplo n.º 13
0
 internal FORBODY(Scope current, YYLTYPE location): base(current, location)
 {
 }
Exemplo n.º 14
0
 internal BLOCKARGS(YYLTYPE location)
     : base(location)
 {
 }
Exemplo n.º 15
0
 internal Scope(Node body, YYLTYPE location)
     : base(location)
 {
     this.body = body;
 }
Exemplo n.º 16
0
 internal VAR get_outer_local(string id, BLOCK block, int depth, YYLTYPE location)
 {
     if (defined_statically(id))
         return new StaticOuterVar(id, block, depth, location);
     else if (defined_dynamically(id))
         return new DynamicOuterVar(id, block, depth, location);
     else
         return block_parent.get_outer_local(id, block, depth + 1, location);
 }
Exemplo n.º 17
0
        //    END { body }

        internal END(Scope parent_scope, YYLTYPE location)
            : base(parent_scope, location)
        {
        }
Exemplo n.º 18
0
 internal override VAR create_local_here(string id, YYLTYPE location)
 {
     block_parent.create_local_here(id, location);
     return get_outer_local(id, this, 0, location);
 }
Exemplo n.º 19
0
        private Node body;        // optional

        internal begin(Node body, YYLTYPE location)
            : base(location)
        {
            this.body = body;
        }
Exemplo n.º 20
0
 internal override void Init(YYLTYPE location, params object[] inputs)
 {
     this.location = location;
     this.formals = (FORMALS)inputs[0];
     this.body = (Node)inputs[1];
 }
Exemplo n.º 21
0
 internal override void Init(YYLTYPE location, params object[] input)
 {
     this.location = location;
     this.args = new MLHS(null, location);
     this.body = (Node)input[0];
 }
Exemplo n.º 22
0
 internal virtual VAR add_local(string id, YYLTYPE location)
 {
     if (defined_statically(id))
         return new StaticLocalVar(id, this, location);
     else if (defined_dynamically(id))
         return new DynamicLocalVar(id, (BLOCK)this, location);
     else if (has_local(id))
         return get_outer_local(id, (BLOCK)this, 0, location);
     else
         return create_local_here(id, location);
 }
Exemplo n.º 23
0
 internal virtual VAR add_locally(string id, YYLTYPE location)
 {
     if (defined_statically(id))
         return new StaticLocalVar(this, id, location);
     else
         return create_local_here(id, location);
 }
Exemplo n.º 24
0
        YYLTYPE name_location; // used by codeDOM for replacing names


        internal DEFN(Scope parent, string method_id, YYLTYPE location, YYLTYPE name_location)
            : base(parent, location)
        {
            this.method_id = method_id;
            this.name_location = name_location;
        }
Exemplo n.º 25
0
 internal virtual VAR create_local_here(string id, YYLTYPE location)
 {
     locals_list.Add(id);
     return new StaticLocalVar(this, id, location);
 }
Exemplo n.º 26
0
        //	def receiver.method_id(args)
        //		body
        //	end

        internal DEFS(Scope parent, string method_id, YYLTYPE location, YYLTYPE name_location): base(parent, method_id, location, name_location)
        {
        }
Exemplo n.º 27
0
 internal Scope(Scope parent_scope, YYLTYPE location)
     : base(location)
 {
     this.parent_scope = parent_scope;
     this.block_parent = null;
 }
Exemplo n.º 28
0
 internal BLOCK(Scope current, YYLTYPE location)
     : base(current, location)
 {
     this.block_parent = current;
 }
Exemplo n.º 29
0
 internal virtual void Init(YYLTYPE location, params object[] inputs)
 {
     this.body = (Node)inputs[0];
     this.location = location;
 }
Exemplo n.º 30
0
        internal override void Init(YYLTYPE location, params object[] input)
        {
            this.location = location;
            this.args = (LVALUE)input[0];
            body = (Node)input[1];

            Node list = this.args;

            if (list == null)
                arity = -1;
            else
            {
                arity = 0;

                if (list is MLHS)
                    list = ((MLHS)list).elements;

                while (list != null)
                {
                    arity++;

                    if (list is LHS_STAR)
                        arity = -arity;

                    list = (LVALUE)list.nd_next;
                }
            }
        }