From 6b8f76ce9b5522998509e846b5724c0d12537a9b Mon Sep 17 00:00:00 2001 From: Oliver Steele Date: Sat, 15 Jul 2017 10:40:05 -0400 Subject: [PATCH] Rename xxxTagParser -> xxxTagCompiler --- tags/control_flow_tags.go | 4 ++-- tags/iteration_tags.go | 2 +- tags/standard_tags.go | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tags/control_flow_tags.go b/tags/control_flow_tags.go index ebef820..25c9cad 100644 --- a/tags/control_flow_tags.go +++ b/tags/control_flow_tags.go @@ -38,7 +38,7 @@ func (c elseCase) body() *render.BlockNode { return c.b } func (c elseCase) test(interface{}, render.Context) (bool, error) { return true, nil } -func caseTagParser(node render.BlockNode) (func(io.Writer, render.Context) error, error) { +func caseTagCompiler(node render.BlockNode) (func(io.Writer, render.Context) error, error) { // TODO parse error on non-empty node.Body expr, err := e.Parse(node.Args) if err != nil { @@ -75,7 +75,7 @@ func caseTagParser(node render.BlockNode) (func(io.Writer, render.Context) error }, nil } -func ifTagParser(polarity bool) func(render.BlockNode) (func(io.Writer, render.Context) error, error) { // nolint: gocyclo +func ifTagCompiler(polarity bool) func(render.BlockNode) (func(io.Writer, render.Context) error, error) { // nolint: gocyclo return func(node render.BlockNode) (func(io.Writer, render.Context) error, error) { type branchRec struct { test e.Expression diff --git a/tags/iteration_tags.go b/tags/iteration_tags.go index ff55c73..a2f776a 100644 --- a/tags/iteration_tags.go +++ b/tags/iteration_tags.go @@ -59,7 +59,7 @@ func cycleTag(args string) (func(io.Writer, render.Context) error, error) { // TODO is the Liquid syntax compatible with a context-free lexer instead? var loopRepairMatcher = regexp.MustCompile(`^(.+\s+in\s+\(.+)\.\.(.+\).*)$`) -func loopTagParser(node render.BlockNode) (func(io.Writer, render.Context) error, error) { +func loopTagCompiler(node render.BlockNode) (func(io.Writer, render.Context) error, error) { src := node.Args if m := loopRepairMatcher.FindStringSubmatch(src); m != nil { src = m[1] + " .. " + m[2] diff --git a/tags/standard_tags.go b/tags/standard_tags.go index 78a6980..6269a2f 100644 --- a/tags/standard_tags.go +++ b/tags/standard_tags.go @@ -19,14 +19,14 @@ func AddStandardTags(c render.Config) { c.AddTag("break", breakTag) c.AddTag("continue", continueTag) c.AddTag("cycle", cycleTag) - c.AddBlock("capture").Compiler(captureTagParser) - c.AddBlock("case").Clause("when").Clause("else").Compiler(caseTagParser) + c.AddBlock("capture").Compiler(captureTagCompiler) + c.AddBlock("case").Clause("when").Clause("else").Compiler(caseTagCompiler) c.AddBlock("comment") - c.AddBlock("for").Compiler(loopTagParser) - c.AddBlock("if").Clause("else").Clause("elsif").Compiler(ifTagParser(true)) + c.AddBlock("for").Compiler(loopTagCompiler) + c.AddBlock("if").Clause("else").Clause("elsif").Compiler(ifTagCompiler(true)) c.AddBlock("raw") - c.AddBlock("tablerow").Compiler(loopTagParser) - c.AddBlock("unless").Compiler(ifTagParser(false)) + c.AddBlock("tablerow").Compiler(loopTagCompiler) + c.AddBlock("unless").Compiler(ifTagCompiler(false)) } func assignTag(source string) (func(io.Writer, render.Context) error, error) { @@ -45,7 +45,7 @@ func assignTag(source string) (func(io.Writer, render.Context) error, error) { }, nil } -func captureTagParser(node render.BlockNode) (func(io.Writer, render.Context) error, error) { +func captureTagCompiler(node render.BlockNode) (func(io.Writer, render.Context) error, error) { // TODO verify syntax varname := node.Args return func(w io.Writer, ctx render.Context) error {