Ejemplo n.º 1
0
            public override bool Accept(SetStatement element, int data)
            {
                if (element.expression.Accept(this, 0))
                {
                    throw new InvalidOperationException("Assign to not returning expression");
                }
                int index;

                index = Array.IndexOf(currentFunction.arguments, element.varName);
                if (index >= 0)
                {
                    if (index == (byte)index)
                    {
                        il.Emit(OpCodes.Starg_S, (byte)index);
                    }
                    else
                    {
                        il.Emit(OpCodes.Starg, index);
                    }
                    return(true);
                }
                index = Array.IndexOf(currentFunction.locals, element.varName);
                if (index >= 0)
                {
                    il.Emit(OpCodes.Stloc, index);
                    return(true);
                }
                il.Emit(OpCodes.Stsfld, parent.storage.GetField(element.varName, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public));
                return(true);
            }
Ejemplo n.º 2
0
 protected override void VisitSet(SetStatement statement)
 {
     State.Write(Symbols.SET);
     if (statement.Assign != null)
     {
         VisitToken(statement.Assign);
     }
 }
Ejemplo n.º 3
0
        /// <summary>Activa o desactiva la opcion indicada para todo el batch</summary>
        public void AddStatement(SetStatement sta, bool val)
        {
            BatchStatement bchOpt = new BatchStatement();

            bchOpt.Name  = sta;
            bchOpt.Value = val;
            foreach (BatchStatement bo in lstStatements)
            {
                if (bo.Name == sta)
                {
                    bo.Value = val;
                    return;
                }
            }
            lstStatements.Add(bchOpt);
        }
Ejemplo n.º 4
0
        private Statement ParseSetStatement()
        {
            // parse statement declaration
            SetStatement stm = new SetStatement(current.Line, current.Column);

            Consume(TokenType.Set);

            // parse tag attributes
            do
            {
                if (Current.TokenType != TokenType.Attribute)
                {
                    throw new ParserException("Expected tag attribute", stm.Line, stm.Column);
                }

                string attrName = Current.Data;
                Consume(TokenType.Attribute);
                Consume(TokenType.Assign);

                // look for "test" attribute
                if (attrName == "name")
                {
                    stm.Name = Current.Data;
                    Consume(TokenType.String);
                }
                else if (attrName == "value")
                {
                    stm.ValueExpression = ParseExpression();
                }
            }while (Current.TokenType == TokenType.Attribute);

            // check statement
            if (stm.Name == null)
            {
                throw new ParserException("\"name\" attribute was not specified", stm.Line, stm.Column);
            }
            if (stm.ValueExpression == null)
            {
                throw new ParserException("\"value\" attribute was not specified", stm.Line, stm.Column);
            }

            // it must be an "empty" tag
            Consume(TokenType.EmptyTag);

            return(stm);
        }
Ejemplo n.º 5
0
        public List <SetStatement> ParseSetStatement(SetStatementContext node)
        {
            List <SetStatement> statements = new List <SetStatement>();

            foreach (var child in node.children)
            {
                if (child is VariableClauseContext variable)
                {
                    SetStatement statement = new SetStatement();

                    statement.Key = new TokenInfo(variable);

                    statements.Add(statement);
                }
                else if (child is PredicateExpressionContext exp)
                {
                    statements.Last().Value = this.ParseToken(exp);
                }
            }

            return(statements);
        }
Ejemplo n.º 6
0
 public virtual void OnSetStatement(SetStatement stmt)
 {
     Enter(new Set(stmt), stmt);
     Exit();
 }
Ejemplo n.º 7
0
 public override object Visit(SetStatement that, object value)
 {
     VisitRoutine(that, value);
     return null;
 }
Ejemplo n.º 8
0
 public override object Visit(SetStatement that, object value)
 {
     _writer.WriteLine("set:");
     that.Block.Visit(this);
     _writer.WriteLine();
     return null;
 }
        public override object Visit(SetStatement that, object value = null)
        {
            PrintPrologue(that);
            PrintRoutine(that);
            PrintEpilogue(that);

            that.Profile.Visit(this);
            that.Block.Visit(this);

            return null;
        }
Ejemplo n.º 10
0
 protected abstract void VisitSet(SetStatement statement);
Ejemplo n.º 11
0
 protected override void VisitSet(SetStatement statement)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 12
0
 public override object Visit(SetStatement that, object value)
 {
     that.Profile.Visit(this);
     Enter(EncodeRoutine(that.Name.Path, that.Encoded));
     that.Block.Visit(this, (object) true);
     Leave();
     return null;
 }
Ejemplo n.º 13
0
 public virtual R Accept(SetStatement element, A data)
 {
     return(Accept((Base)element, data));
 }
Ejemplo n.º 14
0
 public override object Visit(SetStatement that, object value = null)
 {
     _symbols.EnterBlock(that.Name.Symbol, that);
     that.Profile.Visit(this);
     that.Block.Visit(this);
     _symbols.LeaveBlock(that.Name.Symbol);
     return null;
 }
Ejemplo n.º 15
0
 public virtual object Visit(SetStatement that, object value)
 {
     throw new System.NotImplementedException();
 }