-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hy guys, i'm developing a scripting engine with flex and bison and now
i'm implementing the eval and load functions for this language.
Just to give you an example, the syntax is like :

import std.*;

load( "some_script.hy" );

eval( "foo = 123;" );

println( foo );

So, in my lexer i've implemented the function :

void hyb_parse_string( const char *str ){
    extern int yyparse(void);
    YY_BUFFER_STATE prev, next;
    /*
     * Save current buffer.
     */
    prev = YY_CURRENT_BUFFER;
    /*
     * yy_scan_string will call yy_switch_to_buffer.
     */
    next = yy_scan_string( str );
    /*
     * Do actual parsing (yyparse calls yylex).
     */
    yyparse();
    /*
     * Restore previous buffer.
     */
    yy_switch_to_buffer(prev);
}

But it does not seem to work.
Well, it does but when the string (loaded from a file or directly
evaluated) is finished, i get a sigsegv :

Program received signal SIGSEGV, Segmentation fault.
0xb7f2b801 in yylex () at src/lexer.cpp:1658
1658            if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status ==
YY_BUFFER_NEW )

As you may notice, the sigsegv is generated by the flex/bison code,
not mine ... any hints?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJL80g0AAoJEOp6IutgtnhNVjYIAJMRo8dmBy1dzMpjVtWZVSq+
kd9h3qZg/twUtUJA7MkON77utoTZGLsNjwApxuD4G9qMaqE2d/SmTABEQW1HiW1/
/37xwBbjy6sLcWZkY/pmz10YN3G6NJJnTm95Vz6kBgvSDFFmvJJh8tt0uxmkNAa4
/5QsxL6ilzbnyChOlpPBodCozL6LLJrVBUZjfDTPwbje65DncrkALi2OzW09vwo7
TLfJXDA0cL3ELLy1twfwUNcwwgd4QnXJRje8X5ybLmpIzTzTWsIJKIoCFvJ4hDLw
E6/02jx1Cv2tryr+7pYYToi06zJt6Qvxnd+eweZ7HAshZZuZ+8OWaVqGbdLeHOo=
=FxBd
-----END PGP SIGNATURE-----


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

Reply via email to