PostgreSQL 的 语法分析调用关系
在gram.c 中,有一行:#define yyparse base_yyparse
看gram.y 中,与此对应的是: %name-prefix="base_yy"
而看 bison 的 manual:
http://www.gnu.org/software/bison/manual/html_node/Parser-Function.html
4.1 The Parser Function yyparse
You call the function yyparse
to cause parsing to occur. This function reads tokens, executes actions, and ultimately returns when it encounters end-of-input or an unrecoverable syntax error. You can also write an action which directs yyparse
to return immediately without reading further.
— Function: int yyparse (void)
The value returned by
yyparse
is 0 if parsing was successful (return is due to end-of-input).The value is 1 if parsing failed because of invalid input, i.e., input that contains a syntax error or that causes
YYABORT
to be invoked.The value is 2 if parsing failed due to memory exhaustion.