From c9490d88d14cb19e3a839c7f34db61442445f4e5 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 27 Mar 2024 21:14:00 +1100 Subject: [PATCH] update FML parsers to accept R5 metadata in R4 FML format --- .../hl7/fhir/r5/elementmodel/FmlParser.java | 15 +++--- .../structuremap/StructureMapUtilities.java | 49 +++++++++---------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java index 6ec684800..b1e8cec11 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java @@ -76,14 +76,13 @@ public class FmlParser extends ParserBase { if (lexer.hasComments()) { result.makeElement("description").markLocation(lexer.getCurrentLocation()).setValue(lexer.getAllComments()); } - } else { - while (lexer.hasToken("///")) { - lexer.next(); - String fid = lexer.takeDottedToken(); - Element e = result.makeElement(fid).markLocation(lexer.getCurrentLocation()); - lexer.token("="); - e.setValue(lexer.readConstant("meta value")); - } + } + while (lexer.hasToken("///")) { + lexer.next(); + String fid = lexer.takeDottedToken(); + Element e = result.makeElement(fid).markLocation(lexer.getCurrentLocation()); + lexer.token("="); + e.setValue(lexer.readConstant("meta value")); } lexer.setMetadataFormat(false); if (!result.hasChild("status")) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java index b303e6e51..ce80f7f3b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java @@ -640,31 +640,30 @@ public class StructureMapUtilities { result.setName(lexer.readConstant("name")); result.setDescription(lexer.getAllComments()); result.setStatus(PublicationStatus.DRAFT); - } else { - while (lexer.hasToken("///")) { - lexer.next(); - String fid = lexer.takeDottedToken(); - lexer.token("="); - switch (fid) { - case "url" : - result.setUrl(lexer.readConstant("url")); - break; - case "name" : - result.setName(lexer.readConstant("name")); - break; - case "title" : - result.setTitle(lexer.readConstant("title")); - break; - case "description" : - result.setTitle(lexer.readConstant("description")); - break; - case "status" : - result.setStatus(PublicationStatus.fromCode(lexer.readConstant("status"))); - break; - default: - lexer.readConstant("nothing"); - // nothing - } + } + while (lexer.hasToken("///")) { + lexer.next(); + String fid = lexer.takeDottedToken(); + lexer.token("="); + switch (fid) { + case "url" : + result.setUrl(lexer.readConstant("url")); + break; + case "name" : + result.setName(lexer.readConstant("name")); + break; + case "title" : + result.setTitle(lexer.readConstant("title")); + break; + case "description" : + result.setTitle(lexer.readConstant("description")); + break; + case "status" : + result.setStatus(PublicationStatus.fromCode(lexer.readConstant("status"))); + break; + default: + lexer.readConstant("nothing"); + // nothing } } if (!result.hasId() && result.hasName()) {