help-bison
[Top][All Lists]
Advanced

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

Re: Without standard input


From: Luca
Subject: Re: Without standard input
Date: Fri, 01 May 2009 16:32:12 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Mark Redd ha scritto:
Hi everybody.
I've made my parser using Flex/Bison and it works.

My main function is

main()
{
        yyparse();
}

Now my task is to develop a GUI in order to use it.
Suppose I've a char buffer[xxx] with the text i need to parse (and it is
true, because I'm using a textview), how can I pass it to yyparse()?

Thanks!
_______________________________________________
address@hidden http://lists.gnu.org/mailman/listinfo/help-bison

See "Multiple Input Buffer" in flex help:
http://flex.sourceforge.net/manual/Multiple-Input-Buffers.html#Multiple-Input-Buffers
in this way you can parse a string:

       #include "y.tab.h"
       //declaration
       typedef struct yy_buffer_state *YY_BUFFER_STATE;
       YY_BUFFER_STATE yy_scan_string(const char*str);
       void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);

       //code
       YY_BUFFER_STATE b=yy_scan_string(stringToParse);
       yy_switch_to_buffer(b);
       yyparse();

Luca





reply via email to

[Prev in Thread] Current Thread [Next in Thread]