private Node parseCall() { Token token = expect(Call.class); Call callToken = (Call) token; MixinNode mixin = new MixinNode(); mixin.setBlock(new BlockNode()); mixin.setName(callToken.getValue()); mixin.setLineNumber(callToken.getLineNumber()); mixin.setFileName(filename); mixin.setCall(true); if (StringUtils.isNotBlank(callToken.getArguments())) { mixin.setArguments(callToken.getArguments()); } this.tag(mixin); if(mixin.hasCodeNode()) { mixin.getBlock().push(mixin.getCodeNode()); mixin.setCodeNode(null); } if(mixin.hasBlock() && mixin.getBlock().getNodes().isEmpty()) mixin.setBlock(null); return mixin; }
private Node parseCase() { String val = expect(CaseToken.class).getValue(); Node node = new CaseNode(); node.setValue(val); node.setLineNumber(line()); Node block = new BlockNode(); block.setLineNumber(line()); block.setFileName(filename); expect(Indent.class); while (!(peek() instanceof Outdent)) { if (peek() instanceof Comment) { advance(); } else if (peek() instanceof Newline) { advance(); } else if (peek() instanceof When) { block.push(parseWhen()); } else if (peek() instanceof Default) { block.push(parseDefault()); } else { throw new JadeParserException(filename,lexer.getLineno(),templateLoader,"Unexpected token \"" + this.peek() + "\", expected \"when\", \"default\" or \"newline\""); } } expect(Outdent.class); node.setBlock(block); return node; } /**
private Node parseCall() { Token token = expect(Call.class); Call callToken = (Call) token; MixinNode mixin = new MixinNode(); mixin.setBlock(new BlockNode()); mixin.setName(callToken.getValue()); mixin.setLineNumber(callToken.getLineNumber()); mixin.setFileName(filename); mixin.setCall(true); if (StringUtils.isNotBlank(callToken.getArguments())) { mixin.setArguments(callToken.getArguments()); } this.tag(mixin); if(mixin.hasCodeNode()) { mixin.getBlock().push(mixin.getCodeNode()); mixin.setCodeNode(null); } if(mixin.hasBlock() && mixin.getBlock().getNodes().isEmpty()) mixin.setBlock(null); return mixin; }
private Node parseCase() { String val = expect(CaseToken.class).getValue(); Node node = new CaseNode(); node.setValue(val); node.setLineNumber(line()); Node block = new BlockNode(); block.setLineNumber(line()); block.setFileName(filename); expect(Indent.class); while (!(peek() instanceof Outdent)) { if (peek() instanceof Comment) { advance(); } else if (peek() instanceof Newline) { advance(); } else if (peek() instanceof When) { block.push(parseWhen()); } else if (peek() instanceof Default) { block.push(parseDefault()); } else { throw new JadeParserException(filename,lexer.getLineno(),templateLoader,"Unexpected token \"" + this.peek() + "\", expected \"when\", \"default\" or \"newline\""); } } expect(Outdent.class); node.setBlock(block); return node; } /**