Skip to content

Commit

Permalink
Rename xxxTagParser -> xxxTagCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Jul 15, 2017
1 parent cd23447 commit 6b8f76c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tags/control_flow_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tags/iteration_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
14 changes: 7 additions & 7 deletions tags/standard_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down

0 comments on commit 6b8f76c

Please sign in to comment.