public final BlockContext block() throws RecognitionException { BlockContext _localctx = new BlockContext(_ctx, getState()); enterRule(_localctx, 12, RULE_block); int _la; try { enterOuterAlt(_localctx, 1); { setState(56); match(T__5); setState(60); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__5) | (1L << T__7) | (1L << T__10) | (1L << T__13) | (1L << T__14) | (1L << K_FLOAT) | (1L << K_INT) | (1L << K_VOID) | (1L << ID) | (1L << INT))) != 0)) { { { setState(57); stat(); } } setState(62); _errHandler.sync(this); _la = _input.LA(1); } setState(63); match(T__6); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public final BlockContext block() throws RecognitionException { BlockContext _localctx = new BlockContext(_ctx, getState()); enterRule(_localctx, 12, RULE_block); int _la; try { enterOuterAlt(_localctx, 1); { setState(54); match(15); setState(58); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 6) | (1L << 8) | (1L << 9) | (1L << 10) | (1L << 12) | (1L << 14) | (1L << 15) | (1L << 20) | (1L << 21) | (1L << ID) | (1L << INT))) != 0)) { { { setState(55); stat(); } } setState(60); _errHandler.sync(this); _la = _input.LA(1); } setState(61); match(19); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
private void visitBlock(BlockContext block) { symbolTable.newScope(); for (BlockStatementContext blockStatement : block.blockStatement()) { visitBlockStatement(blockStatement); } symbolTable.dropScope(); }
public void addAlternativeElement(AlternativeElement e) { TreeElement tree = (TreeElement) block; if (nextElementIsRoot) { tree.root = (GrammarAtom) e; nextElementIsRoot = false; } else { super.addAlternativeElement(e); } }
private void checkReturn(BlockContext block) { if (returnType == ValueType.VOID) { method.visitInsn(Opcodes.RETURN); return; } if (block.blockStatement() != null) { int lastStatement = block.blockStatement().size() - 1; BlockStatementContext blockStatement = block.blockStatement(lastStatement); if (blockStatement.statement() != null) { StatementContext statement = blockStatement.statement(); if (statement.jumpStatement() != null) { JumpStatementContext jumpStatement = statement.jumpStatement(); if (jumpStatement.returnSt != null) { return; } } } } throw new GenerationException( "Last statement of function with non-null return type must be return. String: " + block.getText()); }