No announcement yet.

Grammar rule that can handle multiple lines

  • Filter
  • Time
  • Show
Clear All
new posts

  • Grammar rule that can handle multiple lines

    I'm trying to write a grammar rule to specify that smake-line opening brace and next-line opening brace are unimportant differences e.g.

    module A1_3_data_classes_prov_ext_2 {

    /* Anonymous documentation */


    module A1_3_data_classes_prov_ext_2

    // Anonymous documentation

    I can get the expression to detect space + { + newline for the top one but putting the rule in for the bottom one - which would be newline + { + newline doesn't work. Here are the two regexps I've used:


    That one works


    That's what I'm having to use for the second one but really I want it to look like this:


    so that it detects the newline before the brace.

    Am I doing something wrong or is BC3 not able to handle this sort of thing?

    Many thanks for any help you can provide

  • #2

    The RegEx cannot span multiple lines, but if you want to define that any { at the beginning of a line is unimportant, you can use:

    Line breaks that separate text are always important since we align by line. Alternatively, you could use an external conversion to Tidy your data, so your brackets are in the same locations. We have a couple of these formats for download on our Alternatives download page, such as Java Tidied:

    Or an Example KB article, here:

    Please note that saving a converted file will save the text in the new format.
    Aaron P Scooter Software