From 2ef8841e9c7a48eea0f66cfe09d8fe996f43c2b2 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 19 Mar 2023 22:18:45 +1300 Subject: Documentation --- src/parcom/parser.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/parcom/parser.cr b/src/parcom/parser.cr index 95a2e21..d9919e1 100644 --- a/src/parcom/parser.cr +++ b/src/parcom/parser.cr @@ -102,7 +102,7 @@ module Parcom end end - # Creates a parser from an array of `T` that tries to parser + # Creates a parser from an array of `T` that tries to parse # each member of the array in sequence. An identical array is # returned on success. If any of the tokens are absent, the # whole parser fails. @@ -112,6 +112,9 @@ module Parcom Parser(T, T).sequence(ps).named("Token Sequence: #{ts}") end + # Creates a parser from an array of parsers that tries each of + # them in sequence. It returns the result of the first successful + # parser and fails if none of the parsers succeed. # TODO: Allow support for Iterable(Parser(T, U)) def self.first_of(ps : Array(Parser(T, U))) : Parser(T, U) if ps.empty? -- cgit v1.2.1