No announcement yet.

Treat variable prefixes as unimportant

  • Time
  • Show
Clear All
new posts

  • Treat variable prefixes as unimportant

    I'm trying to compare autogenerated C Code where many variables are starting with an prefix of Sabc + random Number followed by a meaningfull name.
    With a new Code generation those random Numbers are changed so I see many differences.

    In BC2 I added a comment grammar rule Sabc\d+ so this differences were unimportant. In BC3 this grammar rule won't work anymore.
    It feels like a grammar rule can't stop within non whitespace.

    Old: Sabc123_variable_name
    New: Sabc124_variable_name

    Does someone have any Idea of how to treat this prefix as unimportant.

  • #2

    Defining unimportant text takes a couple of additional steps in BC3, but you can re-create any BC2 importance definition in BC3. Here's a KB article with a walkthrough and video link:

    In quick summary, you would need to edit the C,C++ File Format, and define a new Grammar Element for "Sabc\d+". You can give this new element a custom name.
    Then in the Session Settings (specific for view, or default for future views) you mark that Element as Unimportant by unchecking it.
    Aaron P Scooter Software


    • #3
      Hello Aaron,
      thanks for your answer.
      I tried it in the way you decribed, but it didn't work.
      It works this way when entering a '.*' at the end, but then the whole word will be treades as uniportant, which is not desired.

      It feels like a unimortant text can't stop within one word.


      • #4

        If you define the regular expression in BC2, you should be able to copy and paste that text into a BC3 grammar element and have it behave the same. The extra step comes from changing the session settings to mark the element as unimportant.

        If you would like us to review your settings, please send in your BCSupport package from the Help menu -> Support; Export to [email protected]
        If you email us, please include a link back to this forum post for our reference.

        Please also include a pair of sample files. A full screen screenshot of it not working on your end may help as well.

        Also, please note that you can have BC2 and BC3 installed on your machine at the same time. This way, you can test both methods at the same time to make sure you are getting the expected results.
        Aaron P Scooter Software