mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-10 14:54:46 +00:00
update R5 engine for style fixes from R4
This commit is contained in:
parent
d58188748c
commit
509f8d46c1
@ -445,7 +445,7 @@ public class Property {
|
||||
}
|
||||
sd = context.fetchResource(StructureDefinition.class, url);
|
||||
if (sd == null)
|
||||
throw new DefinitionException("Unable to find type '"+t+"' for name '"+elementName+"' on property "+definition.getPath());
|
||||
throw new DefinitionException("Unable to find definition '"+url+"' for type '"+t+"' for name '"+elementName+"' on property "+definition.getPath());
|
||||
children = profileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
|
||||
}
|
||||
}
|
||||
|
@ -17,21 +17,13 @@ public class FHIRLexer {
|
||||
|
||||
private SourceLocation location;
|
||||
|
||||
// public FHIRLexerException() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public FHIRLexerException(String message, Throwable cause) {
|
||||
// super(message, cause);
|
||||
// }
|
||||
//
|
||||
// public FHIRLexerException(String message) {
|
||||
// super(message);
|
||||
// }
|
||||
//
|
||||
// public FHIRLexerException(Throwable cause) {
|
||||
// super(cause);
|
||||
// }
|
||||
public FHIRLexerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public FHIRLexerException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public FHIRLexerException(String message, SourceLocation location) {
|
||||
super(message);
|
||||
@ -43,6 +35,7 @@ public class FHIRLexer {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String source;
|
||||
private int cursor;
|
||||
private int currentStart;
|
||||
@ -63,6 +56,7 @@ public class FHIRLexer {
|
||||
currentLocation = new SourceLocation(1, 1);
|
||||
next();
|
||||
}
|
||||
|
||||
public FHIRLexer(String source, int i) throws FHIRLexerException {
|
||||
this.source = Utilities.stripBOM(source);
|
||||
this.cursor = i;
|
||||
@ -87,6 +81,7 @@ public class FHIRLexer {
|
||||
public String getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public SourceLocation getCurrentLocation() {
|
||||
return currentLocation;
|
||||
}
|
||||
@ -337,16 +332,20 @@ public class FHIRLexer {
|
||||
|
||||
return ch == '-' || ch == ':' || ch == 'T' || ch == '+' || ch == 'Z' || Character.isDigit(ch) || (cursor-start == eot && ch == '.' && cursor < source.length()-1&& Character.isDigit(source.charAt(cursor+1)));
|
||||
}
|
||||
|
||||
public boolean isOp() {
|
||||
return ExpressionNode.Operation.fromCode(current) != null;
|
||||
}
|
||||
|
||||
public boolean done() {
|
||||
return currentStart >= source.length();
|
||||
}
|
||||
|
||||
public int nextId() {
|
||||
id++;
|
||||
return id;
|
||||
}
|
||||
|
||||
public SourceLocation getCurrentStartLocation() {
|
||||
return currentStartLocation;
|
||||
}
|
||||
@ -356,10 +355,15 @@ public class FHIRLexer {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public boolean hasComment() {
|
||||
return !done() && current.startsWith("//");
|
||||
}
|
||||
|
||||
public boolean hasComments() {
|
||||
return comments.size() > 0;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getComments() {
|
||||
return comments;
|
||||
}
|
||||
@ -519,6 +523,7 @@ public class FHIRLexer {
|
||||
next();
|
||||
|
||||
}
|
||||
|
||||
public String takeDottedToken() throws FHIRLexerException {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(take());
|
||||
@ -529,6 +534,11 @@ public class FHIRLexer {
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public void skipComments() throws FHIRLexerException {
|
||||
while (!done() && hasComment())
|
||||
next();
|
||||
}
|
||||
|
||||
public int getCurrentStart() {
|
||||
return currentStart;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class FHIRPathEngine {
|
||||
protected void getChildrenByName(Base item, String name, List<Base> result) throws FHIRException {
|
||||
String tn = null;
|
||||
if (isAllowPolymorphicNames()) {
|
||||
// we'll look to see whether we hav a polymorphic name
|
||||
// we'll look to see whether we have a polymorphic name
|
||||
for (Property p : item.children()) {
|
||||
if (p.getName().endsWith("[x]")) {
|
||||
String n = p.getName().substring(0, p.getName().length()-3);
|
||||
@ -1561,7 +1561,7 @@ public class FHIRPathEngine {
|
||||
work.addAll(work2);
|
||||
break;
|
||||
case Constant:
|
||||
work.addAll(resolveConstant(context, exp.getConstant(), false, exp));
|
||||
work.addAll(resolveConstant(context, exp.getConstant(), false, exp, true));
|
||||
break;
|
||||
case Group:
|
||||
work2 = execute(context, focus, exp.getGroup(), atEntry);
|
||||
@ -1719,8 +1719,7 @@ public class FHIRPathEngine {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Base> resolveConstant(ExecutionContext context, Base constant, boolean beforeContext, ExpressionNode expr) throws PathEngineException {
|
||||
private List<Base> resolveConstant(ExecutionContext context, Base constant, boolean beforeContext, ExpressionNode expr, boolean explicitConstant) throws PathEngineException {
|
||||
if (constant == null) {
|
||||
return new ArrayList<Base>();
|
||||
}
|
||||
@ -1733,7 +1732,7 @@ public class FHIRPathEngine {
|
||||
if (context.hasDefinedVariable(varName)) {
|
||||
return context.getDefinedVariable(varName);
|
||||
}
|
||||
return resolveConstant(context, c.getValue(), beforeContext, expr, true);
|
||||
return resolveConstant(context, c.getValue(), beforeContext, expr, explicitConstant);
|
||||
} else if (c.getValue().startsWith("@")) {
|
||||
return new ArrayList<Base>(Arrays.asList(processDateConstant(context.appInfo, c.getValue().substring(1), expr)));
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user