Different results depending on used parse function
nmeum opened this issue · 0 comments
nmeum commented
I am not sure if this is a case of broken backtracing or indeed a bug. But if you consider the following parser:
mpc_or(3, mpc_string("consume"), mpc_string("crossfade"), mpc_string("command"));
it parses different inputs depending on used parser function. With mpc_parse
and mpc_parse_contents
it works as expected and parses {consume, crossfade, command}
. However with mpc_parse_pipe
it only parses consume
and returns the following parser error for crossfade
and command
:
<stdin>:1:1: error: expected "consume", "crossfade" or "command" at 'm'
I noticed that there is a lengthy comment in mpc.c
explaining the difference between those parser functions. After reading that comment I am wondering if this is just a bug in the pipe parser or expected behavior.
For the sake of completeness I am using b31e02e with the following mpc_parse_pipe
sample program:
#include <stdio.h>
#include "../mpc.h"
int main(void) {
mpc_result_t r;
mpc_parser_t* Foobar;
Foobar = mpc_or(3, mpc_string("consume"), mpc_string("crossfade"), mpc_string("command"));
if (mpc_parse_pipe("<stdin>", stdin, Foobar, &r)) {
puts("Success!");
} else {
mpc_err_print(r.error);
mpc_err_delete(r.error);
}
mpc_cleanup(1, Foobar);
return 0;
}