Search in sources :

Example 1 with FilterExpression

use of com.mitchellbosecke.pebble.node.expression.FilterExpression in project Orchid by JavaEden.

the class BaseTagParser method parseBody.

protected Expression<?> parseBody(List<Expression<?>> filterInvocationExpressions, String bodyTagName, TokenStream stream, Parser parser) throws ParserException {
    BodyNode body = parser.subparse(token -> token.test(Token.Type.NAME, "end" + bodyTagName));
    stream.next();
    stream.expect(Token.Type.EXECUTE_END);
    Expression<?> lastExpression = new RenderableNodeExpression(body, stream.current().getLineNumber());
    for (Expression<?> filterInvocationExpression : filterInvocationExpressions) {
        FilterExpression filterExpression = new FilterExpression();
        filterExpression.setRight(filterInvocationExpression);
        filterExpression.setLeft(lastExpression);
        lastExpression = filterExpression;
    }
    return lastExpression;
}
Also used : BodyNode(com.mitchellbosecke.pebble.node.BodyNode) RenderableNodeExpression(com.mitchellbosecke.pebble.node.expression.RenderableNodeExpression) FilterExpression(com.mitchellbosecke.pebble.node.expression.FilterExpression)

Aggregations

BodyNode (com.mitchellbosecke.pebble.node.BodyNode)1 FilterExpression (com.mitchellbosecke.pebble.node.expression.FilterExpression)1 RenderableNodeExpression (com.mitchellbosecke.pebble.node.expression.RenderableNodeExpression)1