From fc1afdcb72d786836479367ef42d7d82069aaf97 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 26 Mar 2023 15:42:56 +1300 Subject: More refactoring --- spec/practical/bf_spec.cr | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'spec/practical/bf_spec.cr') diff --git a/spec/practical/bf_spec.cr b/spec/practical/bf_spec.cr index d1ad488..1eb1d04 100644 --- a/spec/practical/bf_spec.cr +++ b/spec/practical/bf_spec.cr @@ -105,13 +105,9 @@ describe "brainfuck parser" do char_body = bf_char.some.sep_by(other.some).map(&.flatten) just_bf_chars = other.many >> char_body << other.many - loop_start = Parser(Char, Char).token('[').map do |_| - {type: BFOpType::LoopStart, amount: 0} - end + loop_start = Parser(Char, Char).token('[').map_const({type: BFOpType::LoopStart, amount: 0}) - loop_end = Parser(Char, Char).token(']').map do |_| - {type: BFOpType::LoopEnd, amount: 0} - end + loop_end = Parser(Char, Char).token(']').map_const({type: BFOpType::LoopEnd, amount: 0}) read_block = Parser(Char, Char).token(',').some.map do |cs| {type: BFOpType::ByteIn, amount: cs.size} -- cgit v1.2.1