at <- function() literal("a") %then% literal("t")
atat <- rep(c("a", "t"), 2)
# Yields an error message about parser failing on line 5
try(
reporter(match_n(3, at()) %then% eof())(c(atat, "t", "t"))
)
# No error, but parser result
reporter(match_n(2, at()) %then% eof())(atat)
# warning: the input is not completely consumed
try(
reporter(match_n(2, at()))(atat)
)
Run the code above in your browser using DataLab