From 8f302e0063860384f66ec9ec5c84cd1a8c1f1a65 Mon Sep 17 00:00:00 2001 From: Oliver Egger Date: Tue, 25 Aug 2020 23:34:33 +0200 Subject: [PATCH] mend --- .../java/org/hl7/fhir/r5/utils/StructureMapUtilities.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/StructureMapUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/StructureMapUtilities.java index cab76e440..83442379c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/StructureMapUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/StructureMapUtilities.java @@ -914,6 +914,9 @@ public class StructureMapUtilities { String comment = null; if (lexer.hasComment()) { comment = getMultiLineComments(lexer); + if (lexer.done()) { + return ; + } } lexer.token("group"); StructureMapGroupComponent group = result.addGroup(); @@ -1010,7 +1013,6 @@ public class StructureMapUtilities { private void parseRule(StructureMap map, List list, FHIRLexer lexer, boolean newFmt) throws FHIRException { StructureMapGroupRuleComponent rule = new StructureMapGroupRuleComponent(); - list.add(rule); if (!newFmt) { rule.setName(lexer.takeDottedToken()); lexer.token(":"); @@ -1018,8 +1020,12 @@ public class StructureMapUtilities { } else { if (lexer.hasComment()) { rule.setDocumentation(this.getMultiLineComments(lexer)); + if (lexer.hasToken("}")) { + return ; // catched a comment at the end + } } } + list.add(rule); boolean done = false; while (!done) { parseSource(rule, lexer);