No announcement yet.

Applying 2 rules at the same time

  • Filter
  • Time
  • Show
Clear All
new posts

  • Applying 2 rules at the same time

    Hi, I would like to apply several rules.

    One of them ignores the time values the other one is used to capture the code of the message and then ignore several lines.
    Message is something like this:

    When I apply both rules (to define that both elements are not important) it will work as expected but when i only apply time rules (as unimportant) the time of the MessageCodeRule is highlighted, is it possible to ignore the time in this message? I have tried duplicating the time rule putting one above and the other one below the MessageCodeRule but it didn't work.

    03:07:06.9 MESSAGE: NAME OF MESSAGE(code)
    03:07:06.9 VARIABLE_1 = X
    03:07:06.9 VARIABLE_2 = Y
    03:07:06.9 VARIABLE_3 = Z
    03:07:06.9 VARIABLE_4 = O
    03:07:06.9 No More variables
    03:07:06.9 End of Message: Name Of message

    Rule time is \d\d:\d\d:\d\d.\d with settings Category = Basic, Regular Expression Checked
    Message rule is : MESSAGE: NAME OF MESSAGE\(code\) with settings Category = Lines, Regular Expression Checked and Next 9 lines

  • #2

    The sorting of the grammar elements helps break ties, but isn't an absolute priority list: the Message element, if marked as Unimportant, is a larger element and can be defined to swallow the following 9 lines. As a similar example, this can more commonly occur when a line is commented out (the Comment grammar usually is larger and matches over any existing grammars within that line).

    As you've encountered, since the lines are within the Message element, they aren't "time" at all, and are only following the Message definition, while the very first timestamp is the only Time element. If you click the cursor into the text, you can see which grammar element name is currently detected in the bottom status bar of each pane.

    BC4 does not support conditional grammars (or two level definitions). This is something on our wishlist, but is not a short-term project. I'll add your use case to our notes on the subject.
    Aaron P Scooter Software