exclude comment lines in comparison
exclude comment lines in comparison
Hello,
I am using compare it! to find differences in code generated source code files.
In these files there are many lines of automatically generated comment which always differs between the files. However, I want to exclude these comments from comparsion, because they make the results very complex. The comment lines ALways start in the first column either with a / character (C++) or a c character (FORTRAN).
Any help will be appreciated
I am using compare it! to find differences in code generated source code files.
In these files there are many lines of automatically generated comment which always differs between the files. However, I want to exclude these comments from comparsion, because they make the results very complex. The comment lines ALways start in the first column either with a / character (C++) or a c character (FORTRAN).
Any help will be appreciated
Having difficulty with filtering out comment lines...
I am using an assembler with either an * or ; as a first non-white character to denote a comment line.
I have been trying various versions of the following RE to avoid inclusion of comment lines:
^(^t+| +)\*+|;.*
The action I picked is to replace, where the replace field in empty.
I'd like any line starting with a combination of tabs and spaces followed by an * or ; to be utterly ignored in the encoding of BOTH panes.
Is this even feasible???
I have been trying various versions of the following RE to avoid inclusion of comment lines:
^(^t+| +)\*+|;.*
The action I picked is to replace, where the replace field in empty.
I'd like any line starting with a combination of tabs and spaces followed by an * or ; to be utterly ignored in the encoding of BOTH panes.
Is this even feasible???
In:
^\s*[;|\*].*
isn't the | inside of [] unnecessary?
And I'm sorry, I mispoke:
* is a comment delimiter only when it is the first character.
; is a comment delimiter whenever it shows up.
So, I have implemented the following 2 filters:
1) ^s\*+.*
set to "Ignore string with match"
2) ;.*
set to "Replace" with an empty field
But there are still problems...
I am finding that when I set the options to ignore inserted empty lines, and tell the filter to either replace the string with an empty field or to ignore the string (actually, it seems to ignore WHOLE the line?), it still shows up as a difference.
Sometimes it looks like it sort of ignores only the first filtered line in a row of lines unmatched to ignored text in that the comment is not highlighted with colors, but it STILL shows up as hatched in the opposing pane.
If I place a CR/LF or other ignored text (eg - a filtered comment line) in the opposing file, then WinCmp3 truely ignores these lines, but not otherwise.
It is as if the "Ignore Inserted Empty Lines" isn't applied consistently AFTER filtering?
Or is there another setting to get it to fully ignore these filtered lines as if they don't exist? Is a separate one needed?
^\s*[;|\*].*
isn't the | inside of [] unnecessary?
And I'm sorry, I mispoke:
* is a comment delimiter only when it is the first character.
; is a comment delimiter whenever it shows up.
So, I have implemented the following 2 filters:
1) ^s\*+.*
set to "Ignore string with match"
2) ;.*
set to "Replace" with an empty field
But there are still problems...
I am finding that when I set the options to ignore inserted empty lines, and tell the filter to either replace the string with an empty field or to ignore the string (actually, it seems to ignore WHOLE the line?), it still shows up as a difference.
Sometimes it looks like it sort of ignores only the first filtered line in a row of lines unmatched to ignored text in that the comment is not highlighted with colors, but it STILL shows up as hatched in the opposing pane.
If I place a CR/LF or other ignored text (eg - a filtered comment line) in the opposing file, then WinCmp3 truely ignores these lines, but not otherwise.
It is as if the "Ignore Inserted Empty Lines" isn't applied consistently AFTER filtering?
Or is there another setting to get it to fully ignore these filtered lines as if they don't exist? Is a separate one needed?
> isn't the | inside of [] unnecessary
Hmm, probably you are right. I have just used to write it this way.
> 1) ^s\*+.*
I guess you mean ^\s*\*.*
'+' is not necessary - next '.*' will absorb multiple '*', if any
As for problem with "Ignore empty lines", you are right - currently Compare It! does not handle it exactly as it should. The problem is all regexp changes done for comparison are not valid during painting, so commented line is drawn as it is, not as empty.
Hmm, probably you are right. I have just used to write it this way.
> 1) ^s\*+.*
I guess you mean ^\s*\*.*
'+' is not necessary - next '.*' will absorb multiple '*', if any
As for problem with "Ignore empty lines", you are right - currently Compare It! does not handle it exactly as it should. The problem is all regexp changes done for comparison are not valid during painting, so commented line is drawn as it is, not as empty.
Excellent, your suggestion for the "ignore end of line" comments works very well. Will have to go away and ponder why it is what it is, and why it works, though. Thanks very much for that.
As for the first part ...
File 1
File 2
Rule 1
Rule 2
In fact the lines that should be ignored are highlighted as changes.
Cheers
As for the first part ...
File 1
Code: Select all
J Label1
\
Code Line 1
Code Line 2
Skip Variable <> 1
Code Line 3
\ ____________________________________________________________________________________________
\ Initialise Variables
\ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Label1: Code Line 4
Code Line 5
Code Line 6
File 2
Code: Select all
J Label1
\
\ This is an added comment line that should be ignored
\
Code Line 1
Code Line 2
Skip Variable <> 1
Code Line 3
\ ____________________________________________________________________________________________
\ Initialise Variables
\ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Label1: Code Line 4
Code Line 5
Code Line 6
Rule 1
Code: Select all
Search ^\\
Replace ^\\
"Ignore String With Match"
Code: Select all
Search ;.*
Replace ;
"Replace"
Cheers