compareRules : Peg.Rule.Rule -> Peg.Rule.Rule -> Result String ()
Compare two PEG grammar rules for equality. Returns Err message
if the rules are different, or Ok ()
if they are the same.
expected
- The expected rule to compare.actual
- The actual rule to compare.Result String ()
- Err message
if the rules are different, or Ok ()
if they are the same.compareRules
(Sequence [MatchLiteral "a", MatchLiteral "b"])
(Sequence [MatchLiteral "a", MatchLiteral "b"])
--> Ok ()
compareRules
(Sequence [MatchLiteral "a", MatchLiteral "b"])
(Sequence [MatchLiteral "a", MatchLiteral "c"])
--> Err "expected: MatchLiteral \"b\", actual: MatchLiteral \"c\" at position 2"
compareRuleLists : List Peg.Rule.Rule -> List Peg.Rule.Rule -> Result String ()
Compare two lists of PEG grammar rules for equality. Returns Err message
if the rules are different, or Ok ()
if they are the same.
expected
- The expected list of rules to compare.actual
- The actual list of rules to compare.Result String ()
- Err message
if the rules are different, or Ok ()
if they are the same.compareRuleLists
[ Sequence [MatchLiteral "a", MatchLiteral "b"]
, Optional (MatchLiteral "c")
, RuleRef "foo"
]
[ Sequence [MatchLiteral "a", MatchLiteral "b"]
, Optional (MatchLiteral "c")
, RuleRef "foo"
]
--> Ok ()
compareRuleLists
[ Sequence [MatchLiteral "a", MatchLiteral "b"]
, Optional (MatchLiteral "c")
, RuleRef "foo"
]
[ Sequence [MatchLiteral "a", MatchLiteral "b"]
, ZeroOrMore (MatchLiteral "c")
, RuleRef "foo"
]
--> Err "expected: Optional (MatchLiteral \"c\"), actual: ZeroOrMore (MatchLiteral \"c\") at position 1"