aboutsummaryrefslogtreecommitdiff
path: root/src/parcom.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/parcom.cr')
-rw-r--r--src/parcom.cr10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/parcom.cr b/src/parcom.cr
index b75cb0f..0963184 100644
--- a/src/parcom.cr
+++ b/src/parcom.cr
@@ -9,9 +9,9 @@ module Parcom
end
# Provides a more convenient syntax for combining parsers via `Parser#and_then`.
- # The first argument is a string literal used for the name of the parser.
- # The second and third arguments are types used for the parser's type.
- # These are followed by any number of 2-tuples containing a variable name and
+ # The first and second arguments are types used for the parser's type.
+ # The thirs argument is a string literal used for the name of the parser.
+ # This is followed by any number of 2-tuples containing a variable name and
# an expression resolving to a `Parser(t.Class, _)`, whose success value will
# be stored in the aformentioned variable. The `finally` named argument is an
# expression that resolves to a `Parser(t.class, u.class)`.
@@ -20,7 +20,7 @@ module Parcom
# ```
# any_word = Parser(Char, Char).satisfy(&.letter?).some.map(&.join)
# ws = Parser(Char, Array(Char)).satisfy(&.whitespace?).many
- # two_of_same_word = parser_chain "two words", Char, String,
+ # two_of_same_word = parser_chain Char, String, "two words",
# {word, any_word},
# {_, ws},
# finally: Parser.token_sequence(word.chars).map(&.join)
@@ -39,7 +39,7 @@ module Parcom
# ```
#
# This macro is based on Haskell's do-notation.
- macro parser_chain(name, t, u, *steps, finally)
+ macro parser_chain(t, u, name, *steps, finally)
Parser({{t}}, {{u}}).new({{name}}) do |tokens|
{% for tup, index in steps %}
{{tup.last}}.and_then do |{{tup.first}}|