Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt scanner generator
Forum Update on Monday, May 27th 2025

Qt scanner generator

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    ZapB
    wrote on 24 Jul 2011, 13:43 last edited by
    #1

    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?

    Nokia Certified Qt Specialist
    Interested in hearing about Qt related work

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on 24 Jul 2011, 15:36 last edited by
      #2

      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.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0

      1/2

      24 Jul 2011, 13:43

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved