Does a statement consume a 'dangling else'? A statement consumes
a 'dangling else' if an 'else' token following the statement
would be considered by the parser to be part of the statement.
979997
private static boolean consumesDanglingElse(Node n) {
    while (true) {
      switch (n.getToken()) {
        case IF:
          if (n.getChildCount() < 3) {
            return true;
          }
          // This IF node has no else clause.
          n = n.getLastChild();
          continue;
        case BLOCK:
          if (!n.hasOneChild()) {
            return false;
          }
          // This BLOCK has no curly braces.
          n = n.getLastChild();
          continue;
        case WITH:
        case WHILE:
        case FOR:
        case FOR_IN:
          n = n.getLastChild();
          continue;
        default:
          return false;
      }
    }
  }
231495
private ParseTree parseContinueStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.CONTINUE);
    IdentifierToken name = null;
    if (!peekImplicitSemiColon()) {
      name = eatIdOpt();
    }
    eatPossibleImplicitSemiColon();
    return new ContinueStatementTree(getTreeLocation(start), name);
  }
1279193
def _do_if_else_condition(self, condition):
        
        self.save()
        d = self.dispatch_table
        if condition:
            self.start_handling_includes()
            d['elif'] = self.stop_handling_includes
            d['else'] = self.stop_handling_includes
        else:
            self.stop_handling_includes()
            d['elif'] = self.do_elif
            d['else'] = self.start_handling_includes
988674
private boolean peekStatementStandard() {
    switch (peekType()) {
    case OPEN_CURLY:
    case VAR:
    case CONST:
    case SEMI_COLON:
    case IF:
    case DO:
    case WHILE:
    case FOR:
    case CONTINUE:
    case BREAK:
    case RETURN:
    case WITH:
    case SWITCH:
    case THROW:
    case TRY:
    case DEBUGGER:
    case YIELD:
    case IDENTIFIER:
    case TYPE:
    case DECLARE:
    case MODULE:
    case NAMESPACE:
    case THIS:
    case CLASS:
    case SUPER:
    case NUMBER:
    case STRING:
    case NO_SUBSTITUTION_TEMPLATE:
    case TEMPLATE_HEAD:
    case NULL:
    case TRUE:
    case SLASH: // regular expression literal
    case SLASH_EQUAL: // regular expression literal
    case FALSE:
    case OPEN_SQUARE:
    case OPEN_PAREN:
    case NEW:
    case DELETE:
    case VOID:
    case TYPEOF:
    case PLUS_PLUS:
    case MINUS_MINUS:
    case PLUS:
    case MINUS:
    case TILDE:
    case BANG:
      return true;
    default:
      return false;
    }
  }
1033966
def p_Statement(p):
    '''
    
    '''
    if len(p) < 3:
        term = Terminator('')
    else:
        term = p[2]
    p[0] = Statement(p[1], term)
566279
public final void throwStatement() throws RecognitionException {
		int throwStatement_StartIndex = input.index();

		Token s=null;
		Token c=null;
		ParserRuleReturnScope expression3 =null;


		        JavaThrowBlockDescr d = null;
		    
		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 84) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:754:5: (s= 'throw' expression c= ';' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:754:7: s= 'throw' expression c= ';'
			{
			s=(Token)match(input,112,FOLLOW_112_in_throwStatement3171); if (state.failed) return;
			pushFollow(FOLLOW_expression_in_throwStatement3177);
			expression3=expression();
			state._fsp--;
			if (state.failed) return;
			c=(Token)match(input,52,FOLLOW_52_in_throwStatement3187); if (state.failed) return;
			if ( state.backtracking==0 ) {
			        d = new JavaThrowBlockDescr( );
			        d.setStart( ((CommonToken)s).getStartIndex() );
			        d.setTextStart( ((CommonToken)(expression3!=null?(expression3.start):null)).getStartIndex() );        
			        this.addBlockDescr( d );
			        d.setEnd( ((CommonToken)c).getStopIndex() ); 
			        }
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 84, throwStatement_StartIndex); }

		}
	}
712010
private ParseTree parseThrowStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.THROW);
    ParseTree value = null;
    if (peekImplicitSemiColon()) {
      reportError("semicolon/newline not allowed after 'throw'");
    } else {
      value = parseExpression();
    }
    eatPossibleImplicitSemiColon();
    return new ThrowStatementTree(getTreeLocation(start), value);
  }
1104663
def statement(type, hook, opt={})
      lang = opt[:lang] || Cog.active_language
      lang.comment_pattern("#{type}\\s*:\\s*(#{hook})\\s*(?:\\(\\s*(.+?)\\s*\\))?(\\s*once\\s*)?(?:\\s*([{]))?")
    end
1118973
def p_statement_break(p):
    ''''''
    if len(p) == 3:
        p[0] = ast.Break(None, lineno=p.lineno(1))
    else:
        p[0] = ast.Break(p[2], lineno=p.lineno(1))
1221317
def p_while_statement(p):
    ''''''
    if len(p) == 2:
        p[0] = p[1]
    else:
        p[0] = ast.Block(p[2], lineno=p.lineno(1))
121954
function eatUnquoted(stream) {
	const start = stream.pos;
	if (stream.eatWhile(isUnquoted)) {
		stream.start = start;
		return true;
	}
}
986231
public final void blockStatement() throws RecognitionException {
		int blockStatement_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 81) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:697:5: ( localVariableDeclaration | classOrInterfaceDeclaration | statement )
			int alt105=3;
			alt105 = dfa105.predict(input);
			switch (alt105) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:697:7: localVariableDeclaration
					{
					pushFollow(FOLLOW_localVariableDeclaration_in_blockStatement2791);
					localVariableDeclaration();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:698:7: classOrInterfaceDeclaration
					{
					pushFollow(FOLLOW_classOrInterfaceDeclaration_in_blockStatement2799);
					classOrInterfaceDeclaration();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:699:11: statement
					{
					pushFollow(FOLLOW_statement_in_blockStatement2811);
					statement();
					state._fsp--;
					if (state.failed) return;
					}
					break;

			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 81, blockStatement_StartIndex); }

		}
	}
1313054
private final boolean elseStatement(Data data, Condition cont) throws TemplateException {
	if (!data.srcCode.forwardIfCurrent("else", '{') && !data.srcCode.forwardIfCurrent("else ") && !data.srcCode.forwardIfCurrent("else", '/')) return false;

	// start (
	data.srcCode.previous();
	// ex block
	Body body = new BodyBase(data.factory);
	Pair p = cont.setElse(body, data.srcCode.getPosition(), null);

	Body prior = data.setParent(body);
	statement(data, body, CTX_ELSE);
	data.setParent(prior);

	p.end = data.srcCode.getPosition();
	return true;
    }
616438
private boolean processTrueOrFalse() {

        if (token.tokenType == Tokens.TRUE) {
            read();

            return true;
        } else if (token.tokenType == Tokens.FALSE) {
            read();

            return false;
        } else {
            throw unexpectedToken();
        }
    }
1351593
protected void parseElse() {
        Node parent = peek();
        if (!(parent instanceof IfNode)) {
            return;
        }
        IfNode ifNode = (IfNode) pop();
        ElseNode elseNode = new ElseNode();
        ifNode.setElseNode(elseNode);
        push(elseNode);
        tokenizer.skipWhitespace();
    }
1205218
public static Parser<Token> adjacent(Parser<List<Token>> parser, final Parser<?> otherwise) {
    return parser.next(tokens -> {
        if (tokens.isEmpty()) return Parsers.always();
        int offset = tokens.get(0).index();
        for (Token token : tokens) {
          if (token.index() != offset) {
            return otherwise;
          }
          offset += token.length();
        }
        return Parsers.always();
      }).atomic().source().token();
  }
238946
private static boolean expect(StringTokenizer tokenizer, String token) {
        if (!tokenizer.hasMoreTokens()) {
            return false;
        }
        String s = tokenizer.nextToken();
        if (DEBUG) {
            System.out.println("token=" + s);
        }
        return s.equals(token);
    }