Example #1
0
        public bool SetValue(string symbol, RuntimeValueNode value)
        {
            if (!Values.ContainsKey(symbol))
            {
                return(Parent?.SetValue(symbol, value) == true);
            }

            Values[symbol] = value;
            return(true);
        }
Example #2
0
 private RuntimeBoolValueNode WrapBool(bool b, RuntimeValueNode referenceNode)
 {
     return(new RuntimeBoolValueNode(
                new Parser.Syntax.Expressions.Nodes.Value.BoolValueNode(
                    referenceNode.DefiningToken,
                    b
                    ),
                referenceNode.RuntimeScope
                ));
 }
Example #3
0
        public static RuntimeNode Create(Node node, RuntimeScope scope)
        {
            RuntimeNode n;

            if ((n = RuntimeValueNode.Create(node, scope)) != null)
            {
                return(n);
            }
            if ((n = RuntimeOperator.Create(node, scope)) != null)
            {
                return(n);
            }
            if ((n = RuntimeSymbolNode.Create(node, scope)) != null)
            {
                return(n);
            }

            if ((n = RuntimeScopeNode.Create(node, scope)) != null)
            {
                return(n);
            }

            return(null); // todo handle this case property (exception?)
        }