Returns True if ALL of the given argument are AST nodes
    of the given token (e.g. 'BINARY')
492983
def is_SYMBOL(token, *symbols):
    
    from symbols.symbol_ import Symbol
    assert all(isinstance(x, Symbol) for x in symbols)
    for sym in symbols:
        if sym.token != token:
            return False

    return True
755360
static boolean isUnaryOperatorType(Token type) {
    switch (type) {
      case DELPROP:
      case VOID:
      case TYPEOF:
      case POS:
      case NEG:
      case BITNOT:
      case NOT:
        return true;

      default:
        return false;
    }
  }
457672
public static boolean isBinaryExpressionType(Expression expression, List<String> tokens) {
        if (expression instanceof BinaryExpression) {
            if (tokens.contains(((BinaryExpression) expression).getOperation().getText())) {
                return true;
            }
        }
        return false;
    }
977436
def ast_for_stmts(self, stmts: T) -> None:
        
        if not stmts:
            raise ValueError('no ast found!')
        head, *equals = stmts

        if head.name is NameEnum.TokenDef:
            self.ast_for_token_def(head)
        elif head.name is NameEnum.TokenIgnore:
            self.ast_for_token_ignore(head)
        else:
            self.ast_for_equals(head)

        for each in equals:
            self.ast_for_equals(each)

        # if every combined parser can reach any other combined, 
        # just take any of them and compile it!
        if not self.compile_helper.alone and self._current__combined_parser_name:
            self.compile_helper.alone.add(self._current__combined_parser_name)
741124
def get_all_nodes(self, addr, is_syscall=None, anyaddr=False):
        
        results = [ ]

        for cfg_node in self.graph.nodes():
            if cfg_node.addr == addr or (anyaddr and
                                         cfg_node.size is not None and
                                         cfg_node.addr <= addr < (cfg_node.addr + cfg_node.size)
                                         ):
                if is_syscall and cfg_node.is_syscall:
                    results.append(cfg_node)
                elif is_syscall is False and not cfg_node.is_syscall:
                    results.append(cfg_node)
                else:
                    results.append(cfg_node)

        return results
858384
function isPaddedArgument (node) {
        var parentArray = node.parent().arguments ? node.parent().arguments : node.parent().elements
        var idx = parentArray.indexOf(node)
        if (idx === 0) { // first arg
          if (prePreChar === '(' && preChar === '(' && postChar === ')') { // already padded
            return true
          }
        } else if (idx === parentArray.length - 1) { // last arg
          if (preChar === '(' && postChar === ')' && postPostChar === ')') { // already padded
            return true
          }
        } else { // middle arg
          if (preChar === '(' && postChar === ')') { // already padded
            return true
          }
        }
        return false
      }
1081850
private boolean isNotIncluded(Node x, Node y) {
        Node tmp;

        retry: while(true) {
        int yType = y.getType();

        switch(x.getType()) {
        case NodeType.CTYPE:
            switch(yType) {
            case NodeType.CTYPE:
            {
                CTypeNode cny = (CTypeNode)y;
                CTypeNode cnx = (CTypeNode)x;
                return cny.ctype == cnx.ctype && cny.not != cnx.not && cny.asciiRange == cnx.asciiRange;
            }
            case NodeType.CCLASS:
                // !swap:!
                tmp = x;
                x = y;
                y = tmp;
                // !goto retry;!
                continue retry;

            case NodeType.STR:
                // !goto swap;!
                tmp = x;
                x = y;
                y = tmp;
                continue retry;

            default:
                break;
            } // inner switch
            break;

        case NodeType.CCLASS:
            CClassNode xc = (CClassNode)x;

            switch(yType) {
            case NodeType.CTYPE:
            {
                CTypeNode yc = (CTypeNode)y;
                switch(yc.ctype) {
                case CharacterType.WORD:
                    if (!yc.not) {
                        if (xc.mbuf == null && !xc.isNot()) {
                            for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
                                if (xc.bs.at(i)) {
                                    if (yc.asciiRange) {
                                        if (enc.isSbWord(i)) return false;
                                    } else {
                                        if (enc.isWord(i)) return false;
                                    }
                                }
                            }
                            return true;
                        }
                        return false;
                    } else {
                        if (xc.mbuf != null) return false;
                        for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
                            boolean isWord;
                            if (yc.asciiRange) {
                                isWord = enc.isSbWord(i);
                            } else {
                                isWord = enc.isWord(i);
                            }

                            if (!isWord) {
                                if (!xc.isNot()) {
                                    if (xc.bs.at(i)) return false;
                                } else {
                                    if (!xc.bs.at(i)) return false;
                                }
                            }
                        }
                        return true;
                    }
                    // break; not reached
                default:
                    break;
                } // inner switch
                break;
            }

            case NodeType.CCLASS:
            {
                CClassNode yc = (CClassNode)y;

                for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
                    boolean v = xc.bs.at(i);
                    if ((v && !xc.isNot()) || (!v && xc.isNot())) {
                        v = yc.bs.at(i);
                        if ((v && !yc.isNot()) || (!v && yc.isNot())) return false;
                    }
                }
                if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) return true;
                return false;
                // break; not reached
            }

            case NodeType.STR:
                // !goto swap;!
                tmp = x;
                x = y;
                y = tmp;
                continue retry;

            default:
                break;

            } // inner switch
            break; // case NodeType.CCLASS

        case NodeType.STR:
        {
            StringNode xs = (StringNode)x;
            if (xs.length() == 0) break;

            switch (yType) {
            case NodeType.CTYPE:
                CTypeNode cy = ((CTypeNode)y);
                switch (cy.ctype) {
                case CharacterType.WORD:
                    if (cy.asciiRange) {
                        if (Matcher.isMbcAsciiWord(enc, xs.bytes, xs.p, xs.end)) {
                            return cy.not;
                        } else {
                            return !cy.not;
                        }
                    } else {
                        if (enc.isMbcWord(xs.bytes, xs.p, xs.end)) {
                            return cy.not;
                        } else {
                            return !cy.not;
                        }
                    }

                default:
                    break;

                } // inner switch
                break;

            case NodeType.CCLASS:
                CClassNode cc = (CClassNode)y;
                int code = enc.mbcToCode(xs.bytes, xs.p, xs.p + enc.maxLength());
                return !cc.isCodeInCC(enc, code);

            case NodeType.STR:
                StringNode ys = (StringNode)y;
                int len = xs.length();
                if (len > ys.length()) len = ys.length();
                if (xs.isAmbig() || ys.isAmbig()) {
                    /* tiny version */
                    return false;
                } else {
                    for (int i=0, p=ys.p, q=xs.p; i<len; i++, p++, q++) {
                        if (ys.bytes[p] != xs.bytes[q]) return true;
                    }
                }
                break;

            default:
                break;
            } // inner switch

            break; // case NodeType.STR
        }
        } // switch

        break;
        } // retry: while
        return false;
    }
465901
def _is_wrapped(self, token, tokens):
        
        for t in tokens:
            is_wrapped = self._wraps((token, t))
            if is_wrapped:
                return True
        return False
738587
def is_docstring(node):
    
    return (node.type == syms.simple_stmt and
            len(node.children) > 0 and node.children[0].type == token.STRING)
93278
private static boolean isDeclaration(Node n) {
    switch (n.getParent().getToken()) {
      case LET:
      case CONST:
      case VAR:
      case CATCH:
        return true;
      case FUNCTION:
        return n == n.getParent().getFirstChild();

      case PARAM_LIST:
        return n.getGrandparent().isFunction();

      default:
        return false;
    }
  }
570546
protected boolean isTokenPair(AnalyzedTokenReadings[] tokens, int n, boolean before) {
    if (before) {
      if ((tokens[n-2].hasPosTagStartingWith("SUB") && tokens[n-1].hasPosTagStartingWith("PRP")
              && tokens[n].hasPosTagStartingWith("SUB"))
          || (!tokens[n-2].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n].getToken().equals("hart"))
         ) {
        return true;
      }
    } else {
      if ((tokens[n].hasPosTagStartingWith("SUB") && tokens[n+1].hasPosTagStartingWith("PRP")
              && tokens[n+2].hasPosTagStartingWith("SUB"))
          || (!tokens[n].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n + 2].getToken().equals("hart"))
         ) {
        return true;
      }
    }
    return false;
  }
522253
function(ast, source) {
      if(!ast) return;
      for(var i=0;i<ast.length;i++) {
        var node=ast[i];
        if(node && node.length>=3 && node[0]=='=') {
          // looking for ['=', id, val]
          runtime.ast()[node[1]] = {'ast': [node]};
          runtime.source()[node[1]] = source;
        }
      }
    }
1188534
def visit_BinOp(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        op = node.op
        with self.op_man(op):
            if isinstance(op, ast.Pow):
                # Pow chains right-to-left
                src = self.visit(op).join((self.visit(node.left,
                                                      dfltChaining=False),
                                           self.visit(node.right)))
            else:
                src = self.visit(op).join((self.visit(node.left),
                                           self.visit(node.right,
                                                      dfltChaining=False)))
            return self.wrap_expr(src, dfltChaining)
188990
function verify(node) {
            if (node.operator !== "=" || node.right.type !== "BinaryExpression") {
                return;
            }

            const left = node.left;
            const expr = node.right;
            const operator = expr.operator;

            if (isCommutativeOperatorWithShorthand(operator) || isNonCommutativeOperatorWithShorthand(operator)) {
                if (same(left, expr.left)) {
                    context.report({
                        node,
                        messageId: "replaced",
                        fix(fixer) {
                            if (canBeFixed(left)) {
                                const equalsToken = getOperatorToken(node);
                                const operatorToken = getOperatorToken(expr);
                                const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]);
                                const rightText = sourceCode.getText().slice(operatorToken.range[1], node.right.range[1]);

                                return fixer.replaceText(node, `${leftText}${expr.operator}=${rightText}`);
                            }
                            return null;
                        }
                    });
                } else if (same(left, expr.right) && isCommutativeOperatorWithShorthand(operator)) {

                    /*
                     * This case can't be fixed safely.
                     * If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would
                     * change the execution order of the valueOf() functions.
                     */
                    context.report({
                        node,
                        messageId: "replaced"
                    });
                }
            }
        }
898792
private static boolean _isAllOfSameType(Node[] nodes, short type) {
	for (int i = 0; i < nodes.length; i++) {
	    if (nodes[i].getNodeType() != type) return false;
	}
	return true;
    }
1087189
def function_is_noop(function_node: ast.FunctionDef) -> bool:
    
    return all(node_is_noop(n) for n in function_node.body)
102782
function isCallbackExpression(node, parentNode) {

            // ensure the parent node exists and is an expression
            if (!parentNode || parentNode.type !== "ExpressionStatement") {
                return false;
            }

            // cb()
            if (parentNode.expression === node) {
                return true;
            }

            // special case for cb && cb() and similar
            if (parentNode.expression.type === "BinaryExpression" || parentNode.expression.type === "LogicalExpression") {
                if (parentNode.expression.right === node) {
                    return true;
                }
            }

            return false;
        }