Hi community, When I read the postgres's code,I want to achieve a simple scanner_init, so I decided to write a function to analyse the config(Use yacc && lex) That's means,I need to:
Raw config file -> Buffer -> Parse(Lex && Yacc) -> Complete Now I write the lex && yacc rule file, but the things confuse me is that, they all read from yyin(Always be stdin) and yyout(Always be stdout), And I want to let them read from string, provide by a function user-defined. Like this:(That's my design, not true) int parse(char *string_want_to_analyse) { yacc_init = lex_analyse(string_want_to_analyse); yacc_analyse(yacc_init); } Can someone provide me some advice? Yours, Wen Yi