当前位置: 首页>>代码示例>>Java>>正文


Java BodyNode类代码示例

本文整理汇总了Java中com.mitchellbosecke.pebble.node.BodyNode的典型用法代码示例。如果您正苦于以下问题:Java BodyNode类的具体用法?Java BodyNode怎么用?Java BodyNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BodyNode类属于com.mitchellbosecke.pebble.node包,在下文中一共展示了BodyNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public RenderableNode parse(Token token, Parser parser) throws ParserException {
    TokenStream stream = parser.getStream();
    int lineNumber = token.getLineNumber();

    // skip the 'parallel' token
    stream.next();

    stream.expect(Token.Type.EXECUTE_END);

    BodyNode body = parser.subparse(decideParallelEnd);

    // skip the 'endparallel' token
    stream.next();

    stream.expect(Token.Type.EXECUTE_END);
    return new ParallelNode(lineNumber, body);
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:19,代码来源:ParallelTokenParser.java

示例2: visit

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public void visit(BodyNode node) {
    write("body");
    level++;
    super.visit(node);
    level--;
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:8,代码来源:PrettyPrintNodeVisitor.java

示例3: visit

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public void visit(IfNode node) {
    for (Pair<Expression<?>, BodyNode> pairs : node.getConditionsWithBodies()) {
        pairs.getLeft().accept(this);
        pairs.getRight().accept(this);
    }
    if (node.getElseBody() != null) {
        node.getElseBody().accept(this);
    }
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:11,代码来源:AbstractNodeVisitor.java

示例4: parse

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public RenderableNode parse(Token token, Parser parser) throws ParserException {
    TokenStream stream = parser.getStream();
    int lineNumber = token.getLineNumber();

    // skip the 'filter' token
    stream.next();

    List<Expression<?>> filterInvocationExpressions = new ArrayList<>();

    filterInvocationExpressions.add(parser.getExpressionParser().parseFilterInvocationExpression());

    while(stream.current().test(Type.OPERATOR, "|")){
        // skip the '|' token
        stream.next();
        filterInvocationExpressions.add(parser.getExpressionParser().parseFilterInvocationExpression());
    }

    stream.expect(Token.Type.EXECUTE_END);

    BodyNode body = parser.subparse(endFilter);

    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 new PrintNode(lastExpression, lineNumber);
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:39,代码来源:FilterTokenParser.java

示例5: parseBody

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
private Expression<?> parseBody(TokenStream stream, Parser parser) throws ParserException {
    List<Expression<?>> filterInvocationExpressions = new ArrayList<>();

    if(stream.current().test(Token.Type.PUNCTUATION, ":")) {
        stream.next();
        stream.expect(Token.Type.PUNCTUATION, ":");

        filterInvocationExpressions.add(parser.getExpressionParser().parseFilterInvocationExpression());

        while(stream.current().test(Token.Type.OPERATOR, "|")){
            // skip the '|' token
            stream.next();
            filterInvocationExpressions.add(parser.getExpressionParser().parseFilterInvocationExpression());
        }
    }

    stream.expect(Token.Type.EXECUTE_END);

    BodyNode body = parser.subparse(token -> token.test(Token.Type.NAME, "end" + name));

    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;
}
 
开发者ID:JavaEden,项目名称:Orchid,代码行数:37,代码来源:PebbleWrapperTemplateTag.java

示例6: parse

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public RenderableNode parse(Token token, Parser parser) throws ParserException {
    TokenStream stream = parser.getStream();
    int lineNumber = token.getLineNumber();

    // skip the 'for' token
    stream.next();

    // get the iteration variable
    String iterationVariable = parser.getExpressionParser().parseNewVariableName();

    stream.expect(Token.Type.NAME, "in");

    // get the iterable variable
    Expression<?> iterable = parser.getExpressionParser().parseExpression();

    stream.expect(Token.Type.EXECUTE_END);

    BodyNode body = parser.subparse(this.decideForFork);

    BodyNode elseBody = null;

    if (stream.current().test(Token.Type.NAME, "else")) {
        // skip the 'else' token
        stream.next();
        stream.expect(Token.Type.EXECUTE_END);
        elseBody = parser.subparse(this.decideForEnd);
    }

    if (stream.current().getValue() == null) {
        throw new ParserException(
                null,
                "Unexpected end of template. Pebble was looking for the \"endfor\" tag",
                stream.current().getLineNumber(), stream.getFilename());
    }
    // skip the 'endfor' token
    stream.next();
    stream.expect(Token.Type.EXECUTE_END);

    return new ForNode(lineNumber, iterationVariable, iterable, body, elseBody);
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:42,代码来源:ForTokenParser.java

示例7: parse

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public RenderableNode parse(Token token, Parser parser) throws ParserException {

    TokenStream stream = parser.getStream();

    // skip over the 'macro' token
    stream.next();

    String macroName = stream.expect(Token.Type.NAME).getValue();

    ArgumentsNode args = parser.getExpressionParser().parseArguments(true);

    stream.expect(Token.Type.EXECUTE_END);

    // parse the body
    BodyNode body = parser.subparse(decideMacroEnd);

    // skip the 'endmacro' token
    stream.next();

    stream.expect(Token.Type.EXECUTE_END);

    return new MacroNode(macroName, args, body);
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:25,代码来源:MacroTokenParser.java

示例8: parse

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
@Override
public RenderableNode parse(Token token, Parser parser) throws ParserException {
    TokenStream stream = parser.getStream();
    int lineNumber = token.getLineNumber();

    // skip the 'if' token
    stream.next();

    List<Pair<Expression<?>, BodyNode>> conditionsWithBodies = new ArrayList<>();

    Expression<?> expression = parser.getExpressionParser().parseExpression();

    stream.expect(Token.Type.EXECUTE_END);

    BodyNode body = parser.subparse(this.decideIfFork);

    conditionsWithBodies.add(new Pair<Expression<?>, BodyNode>(expression, body));

    BodyNode elseBody = null;
    boolean end = false;
    while (!end) {
        if (stream.current().getValue() == null) {
            throw new ParserException(
                    null,
                    "Unexpected end of template. Pebble was looking for the \"endif\" tag",
                    stream.current().getLineNumber(), stream.getFilename());
        }

        switch (stream.current().getValue()) {
        case "else":
            stream.next();
            stream.expect(Token.Type.EXECUTE_END);
            elseBody = parser.subparse(this.decideIfEnd);
            break;

        case "elseif":
            stream.next();
            expression = parser.getExpressionParser().parseExpression();
            stream.expect(Token.Type.EXECUTE_END);
            body = parser.subparse(this.decideIfFork);
            conditionsWithBodies.add(new Pair<Expression<?>, BodyNode>(expression, body));
            break;

        case "endif":
            stream.next();
            end = true;
            break;
        default:
            throw new ParserException(
                    null,
                    "Unexpected end of template. Pebble was looking for the following tags \"else\", \"elseif\", or \"endif\"",
                    stream.current().getLineNumber(), stream.getFilename());
        }
    }

    stream.expect(Token.Type.EXECUTE_END);
    return new IfNode(lineNumber, conditionsWithBodies, elseBody);
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:59,代码来源:IfTokenParser.java

示例9: HasRoleNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public HasRoleNode(int lineNumber, Expression<?> value, BodyNode body) {
    super(lineNumber);
    this.value = value;
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:6,代码来源:HasRoleNode.java

示例10: LacksRoleNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public LacksRoleNode(int lineNumber, Expression<?> value, BodyNode body) {
    super(lineNumber);
    this.value = value;
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:6,代码来源:LacksRoleNode.java

示例11: LacksPermissionNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public LacksPermissionNode(int lineNumber, Expression<?> value, BodyNode body) {
    super(lineNumber);
    this.value = value;
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:6,代码来源:LacksPermissionNode.java

示例12: GuestNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public GuestNode(int lineNumber, BodyNode body) {
    super(lineNumber);
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:5,代码来源:GuestNode.java

示例13: HasAllRolesNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public HasAllRolesNode(int lineNumber, Expression<?> value, BodyNode body) {
    super(lineNumber);
    this.value = value;
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:6,代码来源:HasAllRolesNode.java

示例14: UserNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public UserNode(int lineNumber, BodyNode body) {
    super(lineNumber);
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:5,代码来源:UserNode.java

示例15: HasAnyRolesNode

import com.mitchellbosecke.pebble.node.BodyNode; //导入依赖的package包/类
public HasAnyRolesNode(int lineNumber, Expression<?> value, BodyNode body) {
    super(lineNumber);
    this.value = value;
    this.body = body;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:6,代码来源:HasAnyRolesNode.java


注:本文中的com.mitchellbosecke.pebble.node.BodyNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。