public void skipToken(String token) throws FHIRLexerException { if (getCurrent().equals(token)) next(); } public String takeDottedToken() throws FHIRLexerException {
if (lexer.getCurrent().equals("-")) { lexer.take(); lexer.setCurrent("-"+lexer.getCurrent()); if (lexer.getCurrent().equals("+")) { lexer.take(); lexer.setCurrent("+"+lexer.getCurrent()); } else if ("(".equals(lexer.getCurrent())) { lexer.next(); result.setKind(Kind.Group); result.setGroup(parseExpression(lexer, true)); if (!")".equals(lexer.getCurrent())) throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); result.setEnd(lexer.getCurrentLocation()); lexer.next(); } else { if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); if (lexer.getCurrent().startsWith("\"")) result.setName(lexer.readConstant("Path Name")); else if (!result.checkName()) throw lexer.error("Found "+result.getName()+" expecting a valid token name"); if ("(".equals(lexer.getCurrent())) { Function f = Function.fromCode(result.getName()); FunctionDetails details = null;
if (lexer.getCurrent().equals("-")) { lexer.take(); lexer.setCurrent("-"+lexer.getCurrent()); if (lexer.getCurrent().equals("+")) { lexer.take(); lexer.setCurrent("+"+lexer.getCurrent()); } else if ("(".equals(lexer.getCurrent())) { lexer.next(); result.setKind(Kind.Group); result.setGroup(parseExpression(lexer, true)); if (!")".equals(lexer.getCurrent())) throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); result.setEnd(lexer.getCurrentLocation()); lexer.next(); } else { if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); if (lexer.getCurrent().startsWith("\"")) result.setName(lexer.readConstant("Path Name")); else if (!result.checkName()) throw lexer.error("Found "+result.getName()+" expecting a valid token name"); if ("(".equals(lexer.getCurrent())) { Function f = Function.fromCode(result.getName()); FunctionDetails details = null;
public String takeDottedToken() throws FHIRLexerException { StringBuilder b = new StringBuilder(); b.append(take()); while (!done() && getCurrent().equals(".")) { b.append(take()); b.append(take()); } return b.toString(); }
private Base processConstant(FHIRLexer lexer) throws FHIRLexerException { if (lexer.isStringConstant()) { return new StringType(processConstantString(lexer.take(), lexer)).noExtensions(); } else if (Utilities.isInteger(lexer.getCurrent())) { return new IntegerType(lexer.take()).noExtensions(); } else if (Utilities.isDecimal(lexer.getCurrent())) { return new DecimalType(lexer.take()).noExtensions(); } else if (Utilities.existsInList(lexer.getCurrent(), "true", "false")) { return new BooleanType(lexer.take()).noExtensions(); } else if (lexer.getCurrent().equals("{}")) { lexer.take(); return null; } else if (lexer.getCurrent().startsWith("%") || lexer.getCurrent().startsWith("@")) { return new FHIRConstant(lexer.take()); } else throw lexer.error("Invalid Constant "+lexer.getCurrent()); }
public ExpressionNode parse(String path, String name) throws FHIRLexerException { FHIRLexer lexer = new FHIRLexer(path, name); if (lexer.done()) throw lexer.error("Path cannot be empty"); ExpressionNode result = parseExpression(lexer, true); if (!lexer.done()) throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\""); result.check(); return result; }
String srcs = readPrefix(prefixes, lexer); lexer.token(":"); String sc = lexer.getCurrent().startsWith("\"") ? lexer.readConstant("code") : lexer.take(); ConceptMapEquivalence eq = readEquivalence(lexer); String tgts = (eq != ConceptMapEquivalence.UNMATCHED) ? readPrefix(prefixes, lexer) : "";
public void skipToken(String token) throws FHIRLexerException { if (getCurrent().equals(token)) next(); } public String takeDottedToken() throws FHIRLexerException {
target.setVariable(lexer.take()); while (Utilities.existsInList(lexer.getCurrent(), "first", "last", "share", "collate")) { if (lexer.getCurrent().equals("share")) { target.addListMode(StructureMapTargetListMode.SHARE); lexer.next(); target.setListRuleId(lexer.take()); } else if (lexer.getCurrent().equals("first")) target.addListMode(StructureMapTargetListMode.FIRST); else
public String takeDottedToken() throws FHIRLexerException { StringBuilder b = new StringBuilder(); b.append(take()); while (!done() && getCurrent().equals(".")) { b.append(take()); b.append(take()); } return b.toString(); }
private Base processConstant(FHIRLexer lexer) throws FHIRLexerException { if (lexer.isStringConstant()) { return new StringType(processConstantString(lexer.take(), lexer)).noExtensions(); } else if (Utilities.isInteger(lexer.getCurrent())) { return new IntegerType(lexer.take()).noExtensions(); } else if (Utilities.isDecimal(lexer.getCurrent())) { return new DecimalType(lexer.take()).noExtensions(); } else if (Utilities.existsInList(lexer.getCurrent(), "true", "false")) { return new BooleanType(lexer.take()).noExtensions(); } else if (lexer.getCurrent().equals("{}")) { lexer.take(); return null; } else if (lexer.getCurrent().startsWith("%") || lexer.getCurrent().startsWith("@")) { return new FHIRConstant(lexer.take()); } else throw lexer.error("Invalid Constant "+lexer.getCurrent()); }
source.setDefaultValue(new StringType(lexer.readConstant("default value"))); if (Utilities.existsInList(lexer.getCurrent(), "first", "last", "not_first", "not_last", "only_one")) source.setListMode(StructureMapSourceListMode.fromCode(lexer.take()));
if (lexer.hasToken("for")) { lexer.token("for"); if ("type".equals(lexer.getCurrent())) { lexer.token("type"); lexer.token("+");
public ExpressionNode parse(String path, String name) throws FHIRLexerException { FHIRLexer lexer = new FHIRLexer(path, name); if (lexer.done()) throw lexer.error("Path cannot be empty"); ExpressionNode result = parseExpression(lexer, true); if (!lexer.done()) throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\""); result.check(); return result; }
String srcs = readPrefix(prefixes, lexer); lexer.token(":"); String sc = lexer.getCurrent().startsWith("\"") ? lexer.readConstant("code") : lexer.take(); ConceptMapEquivalence eq = readEquivalence(lexer); String tgts = (eq != ConceptMapEquivalence.UNMATCHED) ? readPrefix(prefixes, lexer) : "";
target.setVariable(lexer.take()); while (Utilities.existsInList(lexer.getCurrent(), "first", "last", "share", "collate")) { if (lexer.getCurrent().equals("share")) { target.addListMode(StructureMapTargetListMode.SHARE); lexer.next(); target.setListRuleId(lexer.take()); } else if (lexer.getCurrent().equals("first")) target.addListMode(StructureMapTargetListMode.FIRST); else
if (lexer.hasToken("for")) { lexer.token("for"); if ("type".equals(lexer.getCurrent())) { lexer.token("type"); lexer.token("+");
source.setDefaultValue(new StringType(lexer.readConstant("default value"))); if (Utilities.existsInList(lexer.getCurrent(), "first", "last", "not_first", "not_last", "only_one")) source.setListMode(StructureMapSourceListMode.fromCode(lexer.take()));