From 35ef516e282e3f94eb8ec283c0dffee4460ddd29 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 14 May 2013 09:58:02 -0500 Subject: [PATCH] Add some assertions --- tool/src/org/antlr/v4/analysis/AnalysisPipeline.java | 2 ++ tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java | 1 + 2 files changed, 3 insertions(+) diff --git a/tool/src/org/antlr/v4/analysis/AnalysisPipeline.java b/tool/src/org/antlr/v4/analysis/AnalysisPipeline.java index 079107ad5..5bd84be2e 100644 --- a/tool/src/org/antlr/v4/analysis/AnalysisPipeline.java +++ b/tool/src/org/antlr/v4/analysis/AnalysisPipeline.java @@ -92,6 +92,8 @@ public class AnalysisPipeline { look = anal.getDecisionLookahead(s); g.tool.log("LL1", "look=" + Arrays.toString(look)); } + + assert s.decision + 1 >= g.decisionLOOK.size(); Utils.setSize(g.decisionLOOK, s.decision+1); g.decisionLOOK.set(s.decision, look); g.tool.log("LL1", "LL(1)? " + disjoint(look)); diff --git a/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java b/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java index 12c6742f4..4c1bf948d 100644 --- a/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java +++ b/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java @@ -46,6 +46,7 @@ public class LL1StarBlockSingleAlt extends LL1Loop { loopBackStateNumber = star.loopBackState.stateNumber; this.decision = star.decision; IntervalSet[] altLookSets = factory.getGrammar().decisionLOOK.get(decision); + assert altLookSets.length == 2; IntervalSet enterLook = altLookSets[0]; IntervalSet exitLook = altLookSets[1]; loopExpr = addCodeForLoopLookaheadTempVar(enterLook);