private Node parseIf() throws ParserError {
		// (if condition if-body else-body)
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.IF)) {
			throw new ParserError("No 'IF'", this);
		}

		final Node cond = parseExpr();
		if (cond == null) {
			throw new ParserError("No condition after 'IF'", this);
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after 'IF'", this);
		}

		final Node body = parseTemplateBody();
		if (body == null) {
			throw new ParserError("No body after 'IF'", this);
		}

		Node elseBody = parseElsIf();
		if (elseBody == null) {
			elseBody = parseElse();
		}

		if (!parseEnd()) {
			throw new ParserError("No `[% END %]` after 'IF'", this);
		}

		List<Node> children = new ArrayList<>();
		children.add(cond);
		children.add(body);
		children.add(elseBody);

		return new Node(NodeType.IF, children, PREV_LINE_NUMBER());
	}