Ejemplo n.º 1
0
        /*
         * blockStatement
         * : localVariableDeclarationStatement
         | classOrInterfaceDeclaration
         | statement
         | ;
         | statement
         | : block
         | ';'
         | IDENTIFIER ':' statement
         | expression ';'
         | ... (snip) ...
         | ;
         */

        public IEnumerable <CstNode> SelectStatements(CstNode e)
        {
            var blockStatements = e.Descendants("blockStatement")
                                  .Where(e_ => IsVariableDeclaration(e_) || IsClassDeclaration(e_));
            var statements = e.Descendants("statement")
                             .Where(
                e_ =>
                !IsBlockStatement(e_) && !IsEmptyStatement(e_) &&
                !IsLabeledStatement(e_));

            return(blockStatements.Concat(statements));
        }
Ejemplo n.º 2
0
        public IEnumerable <CstNode> SelectBooleanExpressions(CstNode e)
        {
            var expressions = e.Descendants("expression")
                              .Where(
                e_ => IsIf(e_) || IsWhile(e_) ||
                IsDoWhile(e_) || IsFor(e_) || IsCheckArgument(e_))
                              .Where(e_ => !IsChild(e_, IsCatchBlock));

            return(expressions);
        }
Ejemplo n.º 3
0
        /*
blockStatement 
    : localVariableDeclarationStatement
    | classOrInterfaceDeclaration
    | statement
    ;
statement 
    : block
    | ';'
    | IDENTIFIER ':' statement
	| expression ';'
    | ... (snip) ...
	;
		 */

        public IEnumerable<CstNode> SelectStatements(CstNode e) {
            var blockStatements = e.Descendants("blockStatement")
                    .Where(e_ => IsVariableDeclaration(e_) || IsClassDeclaration(e_));
            var statements = e.Descendants("statement")
                    .Where(
                            e_ =>
                                    !IsBlockStatement(e_) && !IsEmptyStatement(e_)
                                    && !IsLabeledStatement(e_));
            return blockStatements.Concat(statements);
        }
Ejemplo n.º 4
0
 public IEnumerable<CstNode> SelectBooleanExpressions(CstNode e) {
     var expressions = e.Descendants("expression")
             .Where(
                     e_ => IsIf(e_) || IsWhile(e_) ||
                           IsDoWhile(e_) || IsFor(e_) || IsCheckArgument(e_))
             .Where(e_ => !IsChild(e_, IsCatchBlock));
     return expressions;
 }