1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-30 07:18:58 +01:00

Update expressions.y ParseError -> SyntaxError

This commit is contained in:
Oliver Steele 2017-07-19 21:30:25 -04:00
parent dde3ea7604
commit 17c5c9c145

View File

@ -79,7 +79,7 @@ expr2:
string: LITERAL {
s, ok := $1.(string)
if !ok {
panic(ParseError(fmt.Sprintf("expected a string for %q", $1)))
panic(SyntaxError(fmt.Sprintf("expected a string for %q", $1)))
}
$$ = s
};
@ -108,7 +108,7 @@ loop_modifiers: /* empty */ { $$ = loopModifiers{Cols: math.MaxUint32} }
case "reversed":
$1.Reversed = true
default:
panic(ParseError(fmt.Sprintf("undefined loop modifier %q", $2)))
panic(SyntaxError(fmt.Sprintf("undefined loop modifier %q", $2)))
}
$$ = $1
}
@ -117,23 +117,23 @@ loop_modifiers: /* empty */ { $$ = loopModifiers{Cols: math.MaxUint32} }
case "cols":
cols, ok := $3.(int)
if !ok {
panic(ParseError(fmt.Sprintf("loop cols must an integer")))
panic(SyntaxError(fmt.Sprintf("loop cols must an integer")))
}
$1.Cols = cols
case "limit":
limit, ok := $3.(int)
if !ok {
panic(ParseError(fmt.Sprintf("loop limit must an integer")))
panic(SyntaxError(fmt.Sprintf("loop limit must an integer")))
}
$1.Limit = &limit
case "offset":
offset, ok := $3.(int)
if !ok {
panic(ParseError(fmt.Sprintf("loop offset must an integer")))
panic(SyntaxError(fmt.Sprintf("loop offset must an integer")))
}
$1.Offset = offset
default:
panic(ParseError(fmt.Sprintf("undefined loop modifier %q", $2)))
panic(SyntaxError(fmt.Sprintf("undefined loop modifier %q", $2)))
}
$$ = $1
}