private void parseImports(StructureMap result, FHIRLexer lexer) throws FHIRException { lexer.token("imports"); result.addImport(lexer.readConstant("url")); lexer.skipToken(";"); if (lexer.hasComment()) { lexer.next(); } lexer.skipComments(); }
private void parseUses(StructureMap result, FHIRLexer lexer) throws FHIRException { lexer.token("uses"); StructureMapStructureComponent st = result.addStructure(); st.setUrl(lexer.readConstant("url")); if (lexer.hasToken("alias")) { lexer.token("alias"); st.setAlias(lexer.take()); } lexer.token("as"); st.setMode(StructureMapModelMode.fromCode(lexer.take())); lexer.skipToken(";"); if (lexer.hasComment()) { st.setDocumentation(lexer.take().substring(2).trim()); } lexer.skipComments(); }
private void parseConceptMap(StructureMap result, FHIRLexer lexer) throws FHIRLexerException { lexer.token("conceptmap"); ConceptMap map = new ConceptMap(); String id = lexer.readConstant("map id"); if (id.startsWith("#")) throw lexer.error("Concept Map identifier must start with #"); String n = lexer.take(); lexer.token("="); String v = lexer.readConstant("prefix url"); prefixes.put(n, v); 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 StructureMap parse(String text, String srcName) throws FHIRException { FHIRLexer lexer = new FHIRLexer(text, srcName); if (lexer.done()) throw lexer.error("Map Input cannot be empty"); lexer.skipComments(); lexer.token("map"); StructureMap result = new StructureMap(); result.setUrl(lexer.readConstant("url")); lexer.token("="); result.setName(lexer.readConstant("name")); lexer.skipComments(); while (lexer.hasToken("conceptmap")) parseConceptMap(result, lexer); while (lexer.hasToken("uses")) parseUses(result, lexer); while (lexer.hasToken("imports")) parseImports(result, lexer); while (!lexer.done()) { parseGroup(result, lexer); } return result; }
private void parseParameter(StructureMapGroupRuleTargetComponent target, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError { if (!lexer.isConstant(true)) { target.addParameter().setValue(new IdType(lexer.take())); } else if (lexer.isStringConstant()) target.addParameter().setValue(new StringType(lexer.readConstant("??"))); else { target.addParameter().setValue(readConstant(lexer.take(), lexer)); } }
ucum = "ms"; } else ucum = lexer.readConstant("units"); result.setConstant(new Quantity().setValue(new BigDecimal(result.getConstant().primitiveValue())).setSystem("http://unitsofmeasure.org").setCode(ucum)); throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); if (lexer.getCurrent().startsWith("\"")) result.setName(lexer.readConstant("Path Name")); else result.setName(lexer.take());
source.setDefaultValue(new StringType(lexer.readConstant("default value")));
private void parseImports(StructureMap result, FHIRLexer lexer) throws FHIRException { lexer.token("imports"); result.addImport(lexer.readConstant("url")); lexer.skipToken(";"); if (lexer.hasComment()) { lexer.next(); } lexer.skipComments(); }
private void parseUses(StructureMap result, FHIRLexer lexer) throws FHIRException { lexer.token("uses"); StructureMapStructureComponent st = result.addStructure(); st.setUrl(lexer.readConstant("url")); if (lexer.hasToken("alias")) { lexer.token("alias"); st.setAlias(lexer.take()); } lexer.token("as"); st.setMode(StructureMapModelMode.fromCode(lexer.take())); lexer.skipToken(";"); if (lexer.hasComment()) { st.setDocumentation(lexer.take().substring(2).trim()); } lexer.skipComments(); }
public StructureMap parse(String text, String srcName) throws FHIRException { FHIRLexer lexer = new FHIRLexer(text, srcName); if (lexer.done()) throw lexer.error("Map Input cannot be empty"); lexer.skipComments(); lexer.token("map"); StructureMap result = new StructureMap(); result.setUrl(lexer.readConstant("url")); lexer.token("="); result.setName(lexer.readConstant("name")); lexer.skipComments(); while (lexer.hasToken("conceptmap")) parseConceptMap(result, lexer); while (lexer.hasToken("uses")) parseUses(result, lexer); while (lexer.hasToken("imports")) parseImports(result, lexer); while (!lexer.done()) { parseGroup(result, lexer); } return result; }
private void parseConceptMap(StructureMap result, FHIRLexer lexer) throws FHIRLexerException { lexer.token("conceptmap"); ConceptMap map = new ConceptMap(); String id = lexer.readConstant("map id"); if (id.startsWith("#")) throw lexer.error("Concept Map identifier must start with #"); String n = lexer.take(); lexer.token("="); String v = lexer.readConstant("prefix url"); prefixes.put(n, v); 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) : "";
private void parseParameter(StructureMapGroupRuleTargetComponent target, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError { if (!lexer.isConstant(true)) { target.addParameter().setValue(new IdType(lexer.take())); } else if (lexer.isStringConstant()) target.addParameter().setValue(new StringType(lexer.readConstant("??"))); else { target.addParameter().setValue(readConstant(lexer.take(), lexer)); } }
ucum = "ms"; } else ucum = lexer.readConstant("units"); result.setConstant(new Quantity().setValue(new BigDecimal(result.getConstant().primitiveValue())).setSystem("http://unitsofmeasure.org").setCode(ucum)); throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); if (lexer.getCurrent().startsWith("\"")) result.setName(lexer.readConstant("Path Name")); else result.setName(lexer.take());
source.setDefaultValue(new StringType(lexer.readConstant("default value")));