Can somebody explain how the 'parsetree' in the parser( ) function get populated? What I saw is just a NIL. And it is not touched else where in this file.
 
This file is src/backend/parser/parser.c
 
Thanks!
 
Bin
 
/*
 * parser
 *  Given a query in string form, and optionally info about
 *  parameter types, do lexical and syntactic analysis.
 *
 * Returns a list of raw (un-analyzed) parse trees.
 */
List *
parser(StringInfo str, Oid *typev, int nargs)
{
 int   yyresult;
 
 parsetree = NIL;   /* in case parser forgets to set it */
 have_lookahead = false;
 
 scanner_init(str);
 parser_init();
 parse_expr_init();
 parser_param_set(typev, nargs);
 
 yyresult = yyparse();
 
 scanner_finish();
 clearerr(stdin);
 
 if (yyresult)    /* error */
  return NIL;
 
 return parsetree;
}
 

Reply via email to