+ class ParseResult {
+
+ TemplateBlock block;
+
+ String endType;
+
+ public ParseResult(TemplateBlock block, String endType) {
+ this.block = block;
+ this.endType = endType;
+ }
+
+ public String getEndType() {
+ return endType;
+ }
+
+ public TemplateBlock getBlock(String reqType) {
+ if (endType == null && reqType == null)
+ return block;
+ if (endType == null || reqType == null) {
+ throw new Error("Invalid block type: " + endType);
+ }
+ if (endType.equals(reqType))
+ return block;
+ throw new Error("Invalid block type: " + endType);
+ }
+ }
+