Beispiel #1
0
 private void Write(IndexExpressionNode exp)
 {
     Write(exp.Children[0]);
     _code.Append("[");
     Write(exp.Children[1]);
     _code.Append("]");
 }
        private IndexExpressionNode BuildIndexExpressionNode(SyntaxNodeOrToken left, LexSpan lBrac, SyntaxNodeOrToken index, LexSpan rBrac)
        {
            var indexExp = new IndexExpressionNode();

            indexExp.AddNode(left);
            indexExp.AddNode(new BracketToken(lBrac));
            indexExp.AddNode(index);
            indexExp.AddNode(new BracketToken(rBrac));

            return(indexExp);
        }
Beispiel #3
0
        private static PythonNode Wrap(IndexExpression exp, PythonNode parent)
        {
            var result = new IndexExpressionNode(exp)
            {
                Parent = parent
            };

            if (exp.Target != null)
            {
                result.AddChild(Wrap(exp.Target, result));
            }
            if (exp.Index != null)
            {
                result.AddChild(Wrap(exp.Index, result));
            }
            return(result);
        }