Search Postgresql Archives

[Beginner Question]How to let the lex && yacc parsing the string? Instead of the console.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux