private LiquidNode parseInclude(String cnt) throws FHIRException { int i = 1; while (i < cnt.length() && !Character.isWhitespace(cnt.charAt(i))) i++; if (i == cnt.length() || i == 0) throw new FHIRException("Script "+name+": Error reading include: "+cnt); LiquidInclude res = new LiquidInclude(); res.page = cnt.substring(0, i); while (i < cnt.length() && Character.isWhitespace(cnt.charAt(i))) i++; while (i < cnt.length()) { int j = i; while (i < cnt.length() && cnt.charAt(i) != '=') i++; if (i >= cnt.length() || j == i) throw new FHIRException("Script "+name+": Error reading include: "+cnt); String n = cnt.substring(j, i); if (res.params.containsKey(n)) throw new FHIRException("Script "+name+": Error reading include: "+cnt); i++; ExpressionNodeWithOffset t = engine.parsePartial(cnt, i); i = t.getOffset(); res.params.put(n, t.getNode()); while (i < cnt.length() && Character.isWhitespace(cnt.charAt(i))) i++; } return res; }
private LiquidNode parseInclude(String cnt) throws FHIRException { int i = 1; while (i < cnt.length() && !Character.isWhitespace(cnt.charAt(i))) i++; if (i == cnt.length() || i == 0) throw new FHIRException("Script "+name+": Error reading include: "+cnt); LiquidInclude res = new LiquidInclude(); res.page = cnt.substring(0, i); while (i < cnt.length() && Character.isWhitespace(cnt.charAt(i))) i++; while (i < cnt.length()) { int j = i; while (i < cnt.length() && cnt.charAt(i) != '=') i++; if (i >= cnt.length() || j == i) throw new FHIRException("Script "+name+": Error reading include: "+cnt); String n = cnt.substring(j, i); if (res.params.containsKey(n)) throw new FHIRException("Script "+name+": Error reading include: "+cnt); i++; ExpressionNodeWithOffset t = engine.parsePartial(cnt, i); i = t.getOffset(); res.params.put(n, t.getNode()); while (i < cnt.length() && Character.isWhitespace(cnt.charAt(i))) i++; } return res; }
/** * Parse a path for later use using execute * * @param path * @return * @throws PathEngineException * @throws Exception */ public ExpressionNodeWithOffset parsePartial(String path, int i) throws FHIRLexerException { FHIRLexer lexer = new FHIRLexer(path, i); if (lexer.done()) throw lexer.error("Path cannot be empty"); ExpressionNode result = parseExpression(lexer, true); result.check(); return new ExpressionNodeWithOffset(lexer.getCurrentStart(), result); }
/** * Parse a path for later use using execute * * @param path * @return * @throws PathEngineException * @throws Exception */ public ExpressionNodeWithOffset parsePartial(String path, int i) throws FHIRLexerException { FHIRLexer lexer = new FHIRLexer(path, i); if (lexer.done()) throw lexer.error("Path cannot be empty"); ExpressionNode result = parseExpression(lexer, true); result.check(); return new ExpressionNodeWithOffset(lexer.getCurrentStart(), result); }