@Override public void setValue(String value) { super.setValue(value); } }
@Override public void setValue(String value) { super.setValue(value.trim()); } }
/** * default */ private Node parseDefault(){ expect(Default.class); Node when = new CaseNode.When(); when.setValue("default"); when.setBlock(this.parseBlockExpansion()); return when; }
private Node parseAssignment() { Token token = expect(Assignment.class); Token assignmentToken = (Assignment) token; Node node = new AssigmentNode(); node.setName(assignmentToken.getName()); node.setValue(assignmentToken.getValue()); node.setLineNumber(assignmentToken.getLineNumber()); node.setFileName(filename); return node; }
@Override public void setValue(String value) { super.setValue(value); } }
@Override public void setValue(String value) { super.setValue(value.trim()); } }
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; } /**
/** * default */ private Node parseDefault(){ expect(Default.class); Node when = new CaseNode.When(); when.setValue("default"); when.setBlock(this.parseBlockExpansion()); return when; }
private Node parseAssignment() { Token token = expect(Assignment.class); Token assignmentToken = (Assignment) token; Node node = new AssigmentNode(); node.setName(assignmentToken.getName()); node.setValue(assignmentToken.getValue()); node.setLineNumber(assignmentToken.getLineNumber()); node.setFileName(filename); return node; }
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; } /**