private Node parseTextBlock() { BlockNode blockNode = new BlockNode(); blockNode.setLineNumber(line()); blockNode.setFileName(filename); Token body = peek(); if(!(body instanceof PipelessText)){ return null; } this.advance(); ArrayList<String> values = body.getValues(); Node[] textNodes = {}; for (String value : values) { textNodes = ArrayUtils.addAll(textNodes,parseInlineTagsInText(value)); } blockNode.setNodes(new LinkedList<Node>(Arrays.asList(textNodes))); return blockNode; }
private BlockNode parseYield() { advance(); BlockNode block = new BlockNode(); block.setLineNumber(lexer.getLineno()); block.setFileName(filename); block.setYield(true); return block; } private Node parseInterpolation() {
public Node parse() { BlockNode block = new BlockNode(); block.setLineNumber(lexer.getLineno()); block.setFileName(filename); while (!(peek() instanceof Eos)) { if (peek() instanceof Newline) { advance(); } else { Node expr = parseExpr(); if (expr != null) { block.push(expr); } } } if (extending != null) { getContexts().push(extending); Node rootNode = extending.parse(); getContexts().pop(); // hoist mixins Set<String> keySet = this.mixins.keySet(); for (String name : keySet) { rootNode.getNodes().push(this.mixins.get(name)); } return rootNode; } return block; }
private Node blockExpansion() { if (peek() instanceof Colon) { Token token = expect(Colon.class); Colon colon = (Colon) token; BlockNode block = new BlockNode(); block.setLineNumber(colon.getLineNumber()); block.setFileName(filename); block.getNodes().add(parseExpr()); return block; } return block(); }
} else { blockNode = new BlockNode(); blockNode.setLineNumber(block.getLineNumber()); blockNode.setFileName(filename); LiteralNode node = new LiteralNode(); blockNode.setLineNumber(line());
private Node parseText() { Token tok = expect(Text.class); Node[] tokens = this.parseInlineTagsInText(tok.getValue()); if (tokens.length == 1) return tokens[0]; BlockNode node = new BlockNode(); for (int i = 0; i < tokens.length; i++) { node.push(tokens[i]); } node.setValue(tok.getValue()); node.setLineNumber(tok.getLineNumber()); node.setFileName(filename); return node; }
private BlockNode block() { BlockNode block = new BlockNode(); block.setLineNumber(lexer.getLineno()); block.setFileName(filename); expect(Indent.class); while (!(peek() instanceof Outdent)) { if (peek() instanceof Newline) { advance(); } else { Node parseExpr = this.parseExpr(); parseExpr.setFileName(filename); if (parseExpr != null) { block.push(parseExpr); } } } expect(Outdent.class); return block; }
Token next = advance(); BlockNode block = new BlockNode(); block.setLineNumber(next.getLineNumber()); block.setFileName(filename); block.push(parseExpr());
private Node parseTextBlock() { BlockNode blockNode = new BlockNode(); blockNode.setLineNumber(line()); blockNode.setFileName(filename); Token body = peek(); if(!(body instanceof PipelessText)){ return null; } this.advance(); ArrayList<String> values = body.getValues(); Node[] textNodes = {}; for (String value : values) { textNodes = ArrayUtils.addAll(textNodes,parseInlineTagsInText(value)); } blockNode.setNodes(new LinkedList<Node>(Arrays.asList(textNodes))); return blockNode; }
private BlockNode parseYield() { advance(); BlockNode block = new BlockNode(); block.setLineNumber(lexer.getLineno()); block.setFileName(filename); block.setYield(true); return block; } private Node parseInterpolation() {
private Node blockExpansion() { if (peek() instanceof Colon) { Token token = expect(Colon.class); Colon colon = (Colon) token; BlockNode block = new BlockNode(); block.setLineNumber(colon.getLineNumber()); block.setFileName(filename); block.getNodes().add(parseExpr()); return block; } return block(); }
public Node parse() { BlockNode block = new BlockNode(); block.setLineNumber(lexer.getLineno()); block.setFileName(filename); while (!(peek() instanceof Eos)) { if (peek() instanceof Newline) { advance(); } else { Node expr = parseExpr(); if (expr != null) { block.push(expr); } } } if (extending != null) { getContexts().push(extending); Node rootNode = extending.parse(); getContexts().pop(); // hoist mixins Set<String> keySet = this.mixins.keySet(); for (String name : keySet) { rootNode.getNodes().push(this.mixins.get(name)); } return rootNode; } return block; }
} else { blockNode = new BlockNode(); blockNode.setLineNumber(block.getLineNumber()); blockNode.setFileName(filename); LiteralNode node = new LiteralNode(); blockNode.setLineNumber(line());
private Node parseText() { Token tok = expect(Text.class); Node[] tokens = this.parseInlineTagsInText(tok.getValue()); if (tokens.length == 1) return tokens[0]; BlockNode node = new BlockNode(); for (int i = 0; i < tokens.length; i++) { node.push(tokens[i]); } node.setValue(tok.getValue()); node.setLineNumber(tok.getLineNumber()); node.setFileName(filename); return node; }
private BlockNode block() { BlockNode block = new BlockNode(); block.setLineNumber(lexer.getLineno()); block.setFileName(filename); expect(Indent.class); while (!(peek() instanceof Outdent)) { if (peek() instanceof Newline) { advance(); } else { Node parseExpr = this.parseExpr(); parseExpr.setFileName(filename); if (parseExpr != null) { block.push(parseExpr); } } } expect(Outdent.class); return block; }
Token next = advance(); BlockNode block = new BlockNode(); block.setLineNumber(next.getLineNumber()); block.setFileName(filename); block.push(parseExpr());