public static ASTReference literal(String s) { ASTStringLiteral l = new ASTStringLiteral(ParserTreeConstants.JJTSTRINGLITERAL); l.image = s; return makeRef(l); }
public static ASTReference normalizeLiteral(JexlNode literal, Type<?> normalizer) throws NormalizationException { String normalizedImg = normalizer.normalize(literal.image); ASTStringLiteral normalizedLiteral = new ASTStringLiteral(ParserTreeConstants.JJTSTRINGLITERAL); normalizedLiteral.image = normalizedImg; return JexlNodes.makeRef(normalizedLiteral); }
protected static Map<LiteralRange<?>,List<JexlNode>> getBoundedRanges(List<JexlNode> rangeNodes, List<JexlNode> nonIndexedRangeNodes, List<JexlNode> otherNodes) { // if the non-indexed range nodes were split out, then lets group them back into their AND expressions and put them in the // other node list (see getBoundedRanges vs. getBoundedRangesIndexAgnostic) if (nonIndexedRangeNodes != null && otherNodes != null) { Map<LiteralRange<?>,List<JexlNode>> ranges = getBoundedRanges(nonIndexedRangeNodes, otherNodes); for (List<JexlNode> range : ranges.values()) { // create a ref -> ref_exp -> and -> <range nodes> ASTAndNode andNode = new ASTAndNode(ParserTreeConstants.JJTANDNODE); andNode = JexlNodes.children(andNode, range.get(0), range.get(1)); ASTReferenceExpression refExpNode = JexlNodes.wrap(andNode); ASTReference refNode = JexlNodes.makeRef(refExpNode); otherNodes.add(refNode); } } return getBoundedRanges(rangeNodes, otherNodes); }