From f9148bb172e68e0f584c1040e92f34ea3959b94e Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Tue, 7 Mar 2023 23:51:10 +1300 Subject: small tweaks --- src/parcom.cr | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/parcom.cr b/src/parcom.cr index 0f907c4..9063bf9 100644 --- a/src/parcom.cr +++ b/src/parcom.cr @@ -4,7 +4,7 @@ module Parcom class ParserException < Exception end - class Result(T, V) + struct Result(T, V) getter tokens, value def initialize(@tokens : Array(T), @value : V) @@ -97,11 +97,9 @@ module Parcom end def parse(tokens : Array(T)) : Result(T, V) - begin - @p1.parse(tokens) - rescue ParserException - @p2.parse(tokens) - end + @p1.parse(tokens) + rescue ParserException + @p2.parse(tokens) end end end -- cgit v1.2.1