Next: , Previous: , Up: Interface   [Contents][Index]


4.2 The Push Parser Function yypush_parse

You call the function yypush_parse to parse a single token. This function is available if either the ‘%define api.push-pull push’ or ‘%define api.push-pull both’ declaration is used. See A Push Parser.

Function: int yypush_parse (yypstate *yyps)

The value returned by yypush_parse is the same as for yyparse with the following exception: it returns YYPUSH_MORE if more input is required to finish parsing the grammar.

After yypush_parse returns a status other than YYPUSH_MORE, the parser instance yyps may be reused for a new parse.

The fact that the parser state is reusable even after an error simplifies reuse. For example, a calculator application which parses each input line as an expression can just keep reusing the same yyps even if an input was invalid.