@Nullable public ZenCodingNode parse() { ZenCodingNode add = parseAddOrMore(); if (add == null) { return null; } ZenCodingNode result = add; while (true) { ZenCodingToken token = getToken(); if (token != ZenCodingTokens.PIPE) { return result; } advance(); token = getToken(); if (!(token instanceof IdentifierToken)) { return null; } final String filterSuffix = ((IdentifierToken) token).getText(); if (!ZenCodingUtil.checkFilterSuffix(filterSuffix)) { return null; } advance(); result = new FilterNode(result, filterSuffix); } }
@Nullable protected ZenCodingNode parseTemplate() { ZenCodingToken token = getToken(); if (!(token instanceof IdentifierToken)) { return null; } String templateKey = ((IdentifierToken) token).getText(); advance(); TemplateImpl template = myCallback.findApplicableTemplate(templateKey); if (template == null && !ZenCodingUtil.isXML11ValidQName(templateKey)) { return null; } final TemplateToken templateToken = new TemplateToken(templateKey); if (!setTemplate(templateToken, template)) { return null; } return new TemplateNode(templateToken); }