From 86018a99ae80fe657123ad96d52317ede660edd1 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sat, 11 Mar 2023 15:28:48 +1300 Subject: Documentation for struct Result --- src/parcom.cr | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/parcom.cr b/src/parcom.cr index 50f6e7e..028f596 100644 --- a/src/parcom.cr +++ b/src/parcom.cr @@ -69,6 +69,11 @@ module Parcom end end + # A `Result` stores a `Tokens` object and a parsed value, + # and is effectively used to store the state of a parser chain. + # This is used instead of a `Tuple` or `NamedTuple` because: + # 1. This is more idiomatic than a `Tuple`. + # 2. Crystal does not support generic named tuples. struct Result(T, V) getter tokens, value -- cgit v1.2.1