private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException { ExpressionNode result = new ExpressionNode(lexer.nextId()); SourceLocation c = lexer.getCurrentStartLocation(); result.setStart(lexer.getCurrentLocation()); result.setEnd(lexer.getCurrentLocation()); } else if ("(".equals(lexer.getCurrent())) { lexer.next(); if (!")".equals(lexer.getCurrent())) throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); result.setEnd(lexer.getCurrentLocation()); lexer.next(); } else { else result.setName(lexer.take()); result.setEnd(lexer.getCurrentLocation()); if (!result.checkName()) throw lexer.error("Found "+result.getName()+" expecting a valid token name"); result.setEnd(lexer.getCurrentLocation()); lexer.next(); checkParameters(lexer, c, result, details); focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent())); focus.setOpStart(lexer.getCurrentStartLocation()); focus.setOpEnd(lexer.getCurrentLocation()); lexer.next(); focus.setOpNext(parseExpression(lexer, false));
private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException { ExpressionNode result = new ExpressionNode(lexer.nextId()); SourceLocation c = lexer.getCurrentStartLocation(); result.setStart(lexer.getCurrentLocation()); result.setEnd(lexer.getCurrentLocation()); } else if ("(".equals(lexer.getCurrent())) { lexer.next(); if (!")".equals(lexer.getCurrent())) throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); result.setEnd(lexer.getCurrentLocation()); lexer.next(); } else { else result.setName(lexer.take()); result.setEnd(lexer.getCurrentLocation()); if (!result.checkName()) throw lexer.error("Found "+result.getName()+" expecting a valid token name"); result.setEnd(lexer.getCurrentLocation()); lexer.next(); checkParameters(lexer, c, result, details); focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent())); focus.setOpStart(lexer.getCurrentStartLocation()); focus.setOpEnd(lexer.getCurrentLocation()); lexer.next(); focus.setOpNext(parseExpression(lexer, false));