Skip to content

Commit

Permalink
Yacc, ragel source match package moves
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Jul 7, 2017
1 parent d435cf5 commit a7a1ee5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions expression/expressions.y
@@ -1,8 +1,8 @@
%{
package expressions
package expression
import (
"fmt"
"github.com/osteele/liquid/generics"
"github.com/osteele/liquid/evaluator"
)

func init() {
Expand Down Expand Up @@ -105,42 +105,42 @@ rel:
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
a, b := fa(ctx), fb(ctx)
return generics.Equal(a, b)
return evaluator.Equal(a, b)
}
}
| expr NEQ expr {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
a, b := fa(ctx), fb(ctx)
return !generics.Equal(a, b)
return !evaluator.Equal(a, b)
}
}
| expr '>' expr {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
a, b := fa(ctx), fb(ctx)
return generics.Less(b, a)
return evaluator.Less(b, a)
}
}
| expr '<' expr {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
a, b := fa(ctx), fb(ctx)
return generics.Less(a, b)
return evaluator.Less(a, b)
}
}
| expr GE expr {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
a, b := fa(ctx), fb(ctx)
return generics.Less(b, a) || generics.Equal(a, b)
return evaluator.Less(b, a) || evaluator.Equal(a, b)
}
}
| expr LE expr {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
a, b := fa(ctx), fb(ctx)
return generics.Less(a, b) || generics.Equal(a, b)
return evaluator.Less(a, b) || evaluator.Equal(a, b)
}
}
| expr CONTAINS expr { $$ = makeContainsExpr($1, $3) }
Expand All @@ -151,13 +151,13 @@ cond:
| cond AND rel {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
return generics.IsTrue(fa(ctx)) && generics.IsTrue(fb(ctx))
return evaluator.IsTrue(fa(ctx)) && evaluator.IsTrue(fb(ctx))
}
}
| cond OR rel {
fa, fb := $1, $3
$$ = func(ctx Context) interface{} {
return generics.IsTrue(fa(ctx)) || generics.IsTrue(fb(ctx))
return evaluator.IsTrue(fa(ctx)) || evaluator.IsTrue(fb(ctx))
}
}
;
2 changes: 1 addition & 1 deletion expression/scanner.rl
@@ -1,4 +1,4 @@
package expressions
package expression

import "strconv"

Expand Down

0 comments on commit a7a1ee5

Please sign in to comment.