Esempio n. 1
0
        /// <summary>
        /// Returns a new SuiteStatement which is composed of a subset of the statements in this suite statement.
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public SuiteStatement CloneSubset(PythonAst ast, int start, int end)
        {
            var statements = new Statement[end - start + 1];

            for (var i = start; i <= end; i++)
            {
                statements[i - start] = Statements[i];
            }

            var res = new SuiteStatement(statements);

            // propagate white space so we stay mostly the same...
            var itemWhiteSpace  = this.GetListWhiteSpace(ast);
            var colonWhiteSpace = this.GetPreceedingWhiteSpaceDefaultNull(ast);

            if (itemWhiteSpace != null)
            {
                // semi-colon list of statements, must end in a new line, but the original new line
                // could be multiple lines.
                ast.SetAttribute(res, NodeAttributes.ListWhiteSpace, new string[0]);
            }
            else
            {
                ast.SetAttribute(res, NodeAttributes.IsAltFormValue, NodeAttributes.IsAltFormValue);
            }

            return(res);
        }
Esempio n. 2
0
 public virtual void PostWalk(SuiteStatement node)
 {
 }
Esempio n. 3
0
 // SuiteStatement
 public virtual bool Walk(SuiteStatement node)
 {
     return(true);
 }
Esempio n. 4
0
 // SuiteStatement
 public override bool Walk(SuiteStatement node)
 {
     return(Contains(node));
 }
Esempio n. 5
0
 public override void PostWalk(SuiteStatement node)
 {
 }
Esempio n. 6
0
 // SuiteStatement
 public override bool Walk(SuiteStatement node)
 {
     return(false);
 }