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

Поиск
Список
Период
Сортировка
От Wen Yi
Тема [Beginner Question]How to let the lex && yacc parsing the string? Instead of the console.
Дата
Msg-id tencent_2E749C829B9BB4B80B501DD06A99A903A406@qq.com
обсуждение исходный текст
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Junwang Zhao
Дата:
Сообщение: Re: timetz need more bytes than timestamptz
Следующее
От: Evgeny Morozov
Дата:
Сообщение: Re: "PANIC: could not open critical system index 2662" - twice