Qt scanner generator



  • Hey all,

    I'm looking for a Qt-compatible scanner generator to go along with "qlalr":http://qt.nokia.com/developer/qtquarterly/qlalr-adventures/. That is I'm looking for a lexer to work with qlalr much as flex is often used to work with bison or lex with yacc.

    Does anybody know of such a beast or should I just hand-code a lexer for my particular case?



  • I've found one way that gets me part way there with flex which is to simply use the under-documented function yy_scan_string() and pass in QByteArray.constData() as the argument before calling the yyparse() function. ie:

    @
    ...
    QByteArray ba = myString.toUtf8();
    YY_BUFFER_STATE string_buffer = yy_scan_string( ba.constData() );
    yyparse();
    yy_delete_buffer(string_buffer);
    @

    That will probably get me close enough for this little project as I am not expecting to have to worry about UTF16.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.