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!
_______________________________________________
help-bison@gnu.org 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



_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to