Files with comments

General questions about using ExamDiff Pro, ideas for new features, bug reports, and usage tips.
Post Reply
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Files with comments

Post by AlexL »

I have the following files:

File 1:
// My comment 1
0011820940 6c4dad83
0011820949 1283c57f
0011820959 ea0f9dff
0011820968 2afad831
// My comment 2
0011820977 283c57fe
0011820986 a0f9dff2

File 2:
6c4dad83
1283c57f
ea1f9dff
2afad831
283c57fe
a0f9dff2

Each line of the 2-nd file is indented by 11 spaces, which exactly matches the size of the 1-st field (with the following space) of each non-comment line of the 1-st file (seems the forum engine eats these spaces, and I don't know how to prevent this).

I'd like to see differences only in the line that contains field, which begins from "ea1" (2-nd file) (or "ea0" in the 2-nd field of the 1-st file accordingly).

I use "Ignore characters before column 12" option, and this helps to ignore 1-st field in the 1-st file. In addition I tried to use option "Ignore lines matching regular expression //.*", but it does not work in my case: EDP still shows comment lines as different.

How I see only one line as different? It is line 4 in the 1-st file vs. line 3 in the 2-nd file.

Thank you.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

Here's one way: use "Ignore lines matching regular expression" with the following regex:

//.*|^.{11}

Another approach would be to strip all comments using a plug-in (see tutorial at http://www.prestosoft.com/ps.asp?page=edp_tutorial2 ), then use "Ignore characters before column 12" option.
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

Thank you for answer, but:

1) Why
//.*
being applied to option "Ignore lines matching regular expression", does not work?

2) Your solution with
//.*|^.{11}
being applied to option "Ignore lines matching regular expression" does not work. It stops to show differences at all. By the way: why?

3) Your solution works if I apply it to other option: "Ignore parts of each line", provided I add option "Ignore Blank lines".

4) Using plugin also solves this private problem, but it is not comfortable enough, because it requires too many actions for cancelling or ignoring the ignores. In addition, it is too limited. E.g., if I'll have to ignore lines which begin from ';', this specific plugin won't work, and I'll have to use another plugin, or again consider using general options.

So I think using general options is better, especially in my simple case.

That's why I'd like to ask again:
- Why "//.*" being applied to option "Ignore lines matching regular expression" still shows commented lines as different, instead of ignored?
- Why "//.*|^.{11}" being applied to option "Ignore lines matching regular expression" does not show differences at all?

Thank you.

PS: How to prevent eating leading spaces by forum engine?
PPS: I suggest to modify the forum engine so that the subject will be automatically copied to the replying form, when I press "Reply". Now it is empty, unless I fill it manually by the subject of the thread.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

> 1) Why
> //.*
> being applied to option \"Ignore lines matching regular expression\", does not
> work?

The explanation is in http://www.prestosoft.com/ps.asp?page=edp_faq#16

> 2) Your solution with
> //.*|^.{11}
> being applied to option \"Ignore lines matching regular expression\" does not
> work. It stops to show differences at all. By the way: why?

It was a typo: I meant to say to use "Ignore parts of each line -- matching regex".
The wrong solution shows no differences because all lines match and hence are ignored.

> 3) Your solution works if I apply it to other option: \"Ignore parts of each
> line\", provided I add option \"Ignore Blank lines\".

You don't need "Ignore Blank lines". It works with "Ignore parts of each line -- matching regex"

> 4) Using plugin also solves this private problem, but it is not comfortable
> enough, because it requires too many actions for cancelling or ignoring the
> ignores. In addition, it is too limited. E.g., if I\'ll have to ignore lines which
> begin from \';\', this specific plugin won\'t work, and I\'ll have to use another
> plugin, or again consider using general options.

Right. Plugins are good for some general, well-defined transformation, such as
stripping C/C++ comments form a source file.

> PS: How to prevent eating leading spaces by forum engine?

No idea.

> PPS: I suggest to modify the forum engine so that the subject will be
> automatically copied to the replying form, when I press \"Reply\". Now it is empty,
> unless I fill it manually by the subject of the thread.

You don't need to type subject if you don't want to change it. The subject will be the
same as before if you don't type anything in the Subject line.
psguru
PrestoSoft
Post Reply