5 Replies Latest reply on Jul 2, 2013 6:02 AM by sergiob

    Parse error

      Hi,

       

      I'm getting a parse exception with the following simple rule:

       

      RULE test

      CLASS my.class.name

      METHOD method.name

      AT ENTRY

      DO NOTHING

      ENDRULE

       

      I enabled rule debugging and got the following:

       

          [junit] TransformListener() : handling connection on port 9091

          [junit] retransforming my.class.name

          [junit] org.jboss.byteman.agent.Transformer : error parsing rule test

          [junit] org.jboss.byteman.rule.exception.ParseException: rule test

          [junit] java.io.ByteArrayInputStream@283aa791 line 5 : unable to recover from previous errors

       

      And:

       

          [junit] # Initializing parser

          [junit] # Current Symbol is #4

          [junit] # Attempting error recovery

          [junit] # Finding recovery state on stack

          [junit] # Pop stack by one, state was # 0

          [junit] # No recovery state found on stack

          [junit] # Error recovery fails

       

      Which hardly makes sense to me, as line 5 is just "DO NOTHING", so what am I missing?

       

      Thanks,

       

      Sergio B.

        • 1. Re: Parse error

          As an additional info, I tried debugging and verified the RuleScript object contains "DO NOTHING" in the rule text, as expected: then it gets passed to the ECAGrammarParser, and everything breaks as reported.

          • 2. Re: Parse error

            Solved, the problem was the missing "catch all" condition (IF TRUE): I used Byteman long time ago and I was remembering it was not mandatory, but apparently I was wrong, or maybe things changed.

            • 3. Re: Parse error
              adinn

              Hi Sergio,

              Sergio Bossa wrote:

               

              Solved, the problem was the missing "catch all" condition (IF TRUE): I used Byteman long time ago and I was remembering it was not mandatory, but apparently I was wrong, or maybe things changed.

               

              The IF clause has always been mandatory.

               

              I suppose we could relax that requirement but

               

              1. it's hardly a big deal to have to type IF true (although you would be surprised how much it appears to annoy some people :-)
              2. making it mandatory means you have to think about when you want the rule to fire and explicitly specify the 'always' case

               

              The thing I should do  is to add this as an error pattern in the parser. So, when it sees a DO without an intervening IF it will recognise that the condition has been omitted and generate an error message to that effect. I'll raise a JIRA for this. Thanks for reporting your problem.

               

              regards,

               

               

              Andrew Dinn

              • 4. Re: Parse error
                adinn
                • 5. Re: Parse error

                  Hi Andrew,

                   

                  thanks for your answer (and your great work on Byteman).

                   

                  Good to know it has always been mandatory, my memory is definitely faulted, I should have re-read the manual

                  By the way, I'm absolutely fine with keeping it mandatory and having the parser emitting an error if missing.

                   

                  Thanks again,

                  Regards,

                   

                  Sergio B.