fix location bugs in FML parsing

This commit is contained in:
Grahame Grieve 2023-03-07 21:47:38 +11:00
parent e5a4d84a6f
commit 4486c12df5
1 changed files with 4 additions and 4 deletions

View File

@ -362,9 +362,9 @@ public class FmlParser extends ParserBase {
rule.forceElement("target").makeElement("variable").setValue(StructureMapUtilities.AUTO_VAR_NAME); rule.forceElement("target").makeElement("variable").setValue(StructureMapUtilities.AUTO_VAR_NAME);
rule.forceElement("target").makeElement("transform").setValue(StructureMapTransform.CREATE.toCode()); rule.forceElement("target").makeElement("transform").setValue(StructureMapTransform.CREATE.toCode());
Element dep = rule.forceElement("dependent").markLocation(rule); Element dep = rule.forceElement("dependent").markLocation(rule);
dep.makeElement("name").setValue(StructureMapUtilities.DEF_GROUP_NAME); dep.makeElement("name").markLocation(rule).setValue(StructureMapUtilities.DEF_GROUP_NAME);
dep.addElement("parameter").makeElement("valueId").setValue(StructureMapUtilities.AUTO_VAR_NAME); dep.addElement("parameter").markLocation(dep).makeElement("valueId").markLocation(dep).setValue(StructureMapUtilities.AUTO_VAR_NAME);
dep.addElement("parameter").makeElement("valueId").setValue(StructureMapUtilities.AUTO_VAR_NAME); dep.addElement("parameter").markLocation(dep).makeElement("valueId").markLocation(dep).setValue(StructureMapUtilities.AUTO_VAR_NAME);
// no dependencies - imply what is to be done based on types // no dependencies - imply what is to be done based on types
} }
if (newFmt) { if (newFmt) {
@ -387,7 +387,7 @@ public class FmlParser extends ParserBase {
} }
private void parseRuleReference(Element rule, FHIRLexer lexer) throws FHIRLexerException { private void parseRuleReference(Element rule, FHIRLexer lexer) throws FHIRLexerException {
Element ref = rule.addElement("dependent").markLocation(lexer.getCommentLocation()); Element ref = rule.addElement("dependent").markLocation(lexer.getCurrentLocation());
ref.makeElement("name").markLocation(lexer.getCurrentLocation()).setValue(lexer.take()); ref.makeElement("name").markLocation(lexer.getCurrentLocation()).setValue(lexer.take());
lexer.token("("); lexer.token("(");
boolean done = false; boolean done = false;