0

I refer to the comby tool which can be found on https://comby.dev/ and https://github.com/comby-tools/comby.

If I have a file with contents:

   void f();
   void g( );

And I want to refactor both expressions from ; to {} (I know I would be faster with sed, but I want to use comby for more complicated expressions and this is only an example.)

    $ comby 'void :[fname]();' 'void :[fname](){}' ./001.c
    ------ .../001.c
    ++++++ .../001.c
    @|-1,3 +1,3 ============================================================
     |
    -|void f();
    +|void f(){}
     |void g( );


    $ comby 'void :[fname]( );' 'void :[fname](){}' ./001.c
    ------ .../001.c
    ++++++ .../001.c
    @|-1,3 +1,3 ============================================================
     |
     |void f();
    -|void g( );
    +|void g(){}

... then I have to call comby twice in this case. If I had more than 1 different spacings the number of expressions would exponentially grow when I want to cover all combinations.

But what I want is to transform all matching occurrences at once regardless of the presence of spaces .

I found no option for ignoring whitespace - maybe I overlooked one option.

I could theoretically use a code beautifier or I normalize all braces before I use comby.

What is the right way to handle this problem?

0 Answers0