Skip to content

Commit

Permalink
feat(case_block): support comma separated values in when
Browse files Browse the repository at this point in the history
The test still doesn't pass because of using `null`.

fixes #279
  • Loading branch information
Goncalerta committed Dec 1, 2018
1 parent 9235289 commit 0e56f77
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/tags/case_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use compiler::BlockElement;
use compiler::LiquidOptions;
use compiler::TagBlock;
use compiler::TagTokenIter;
use compiler::TryMatchToken;
use interpreter::Context;
use interpreter::Expression;
use interpreter::Renderable;
Expand Down Expand Up @@ -88,9 +89,11 @@ fn parse_condition(arguments: &mut TagTokenIter) -> Result<Vec<Expression>> {
values.push(first_value);

while let Some(token) = arguments.next() {
token
.expect_str("or")
.into_result_custom_msg("\"or\" expected.")?;
if let TryMatchToken::Fails(token) = token.expect_str("or") {
token
.expect_str(",")
.into_result_custom_msg("\"or\" or \",\" expected.")?;
}

let value = arguments
.expect_next("Value expected")?
Expand Down

0 comments on commit 0e56f77

Please sign in to comment.