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. Yacc lex uqestion
Forum Updated to NodeBB v4.3 + New Features

Yacc lex uqestion

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.5k Views 1 Watching
  • 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.
  • appollosputnikA Offline
    appollosputnikA Offline
    appollosputnik
    Banned
    wrote on last edited by
    #1

    I apologize for the inconvenience this not a Qt question. I am using a library in my Qt application which is built and generated by lex and yacc compiler. When I am calling first time the function it's working fine, a good file. Next time running a bad file from within the same application for which it throws an error, from within the same application, now if I call next time for the good file also it throws the error. The problem is the error. If an error occurs then next time onwards it throws error for even for a good file. How can I clear the error stream so that it runs good for the good file. Any help is highly appreciated. Thanks Sujan
    [code]
    bool upgrade_model(char *model, string &newModel); //this function is exposed by the static library.
    [/code]

    [code]
    string newmodel;
    bool upgraded = upgrade_model("/home/red/good.model",&newmodel); // it runs fine
    upgraded = upgrade_model("/home/red/bad.model",&newmodel); //it throws error
    upgraded = upgrade_model("/home/red/good.model",&newmodel); //it throws error
    [/code]

    How can I clear the error stream in the begining when a call is made to the function upgrade_model()

    1 Reply Last reply
    0
    • I Offline
      I Offline
      issam
      wrote on last edited by
      #2

      Hi :)
      It seems that the problem is not with Yacc and Lex.
      Usually, when I get this situation I reboot the computer to fix the problem !

      http://www.iissam.com/

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        You need to address the incorrect maintenance of state between runs with the author of the library.

        1 Reply Last reply
        0
        • appollosputnikA Offline
          appollosputnikA Offline
          appollosputnik
          Banned
          wrote on last edited by
          #4

          Chris please suggest me something. author is inaccessible. I am calling YY_FLUSH_BUFFER; in the lex file. What else need to be done to clear the state. How can I make the state to come back to original state. Please help.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            Since you seem to have direct access to the parser/lexer you should also consider the options discussed here, http://www.gnu.org/software/bison/manual/html_node/How-Can-I-Reset-the-Parser.html, which id GNU Bison specific but might give you a clue if you are using a different parser/lexer. The link to flex "Start Conditions" on that page should be: http://flex.sourceforge.net/manual/Start-Conditions.html#Start-Conditions

            If the intermediate library is broken and the source/author is unavailable then you really have no choice but to replace the library.

            1 Reply Last reply
            0

            • Login

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