Hi all,
I am stuck up in middle of a process.
I have 2 files A and B.
Some lines in A are commented with either // or /* */
But basically content (uncommented portion) of both the files are same.
Now I want to prove that both the files are same using some script.
I can't do a diff as it will give me commented lines as difference.
I thought of an algo for this:
1.Format both the files to remove leading and trailing blank spaces,append some char(~~~) to mark \n.
Do the following(Step 2-4) for both the files
2.Create only valid fields file by removing /**/ and //
2.1.Put all characters in array
2.2.Read a char and check if it is / If YES go to 2.3 else go to step 3
2.3.If YES, then check the next char to be / or *
2.4.If next char is * then Create a REJECT array and store the chars till */ is encountered
2.5.If next char is / then Create a REJECT array and store the chars till \n in encountered
3.Put all valid fields in VALID array
4.Reconstruct the file with elements from VALID array(thats why I had used the indicator "~~~")
5.Do diff for both files now
Till step 2.1 I am done.but I am now confused
with step 2.3
Any other alternative ideas welcomed.