diff options
| author | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-19 22:18:45 +1300 |
|---|---|---|
| committer | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-19 22:18:45 +1300 |
| commit | 2ef8841e9c7a48eea0f66cfe09d8fe996f43c2b2 (patch) | |
| tree | 78f4e670b066c41d2552db2fa598bb0aa185ea0c /src | |
| parent | 54263a0cfec5ef1adcd1bf6541abc0275d9a98df (diff) | |
Documentation
Diffstat (limited to 'src')
| -rw-r--r-- | src/parcom/parser.cr | 5 |
1 files changed, 4 insertions, 1 deletions
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? |
