!SideDiff: Regex to Remove Assembler Comments ?
Ralph Barrett (1603) 154 posts |
The !SideDiff utility is very useful from comparing two Basic files. I’m using !SideDiff for comparing different versions of the !ARM_Debug main module, which are large Basic files containing ARM assembler. !Sidediff supports ‘regex’ for text files. So I can easily convert two similar files to Basic text for subsequent comparison. However, most of the differences that !Sidediff finds are just my comments, as I’m going through trying to comment Theo’s original code. I’m using the ‘;’ character to denote the start of a comment whilst in the Basic assembler. Q. What regex command will remove these assembler comments from the ‘Diff’ comparison ? Q. Does the !SideDiff regex functionality still work on Risc OS 5 ? I tried a few regexes, but nothing seemed to work :-( Ralph |
Martin Avison (27) 1494 posts |
My reading of the SideDiff 2.44 Help is that the ‘regex’ syntax is only used to specify what type of line to consider as the start of a section so it can be displayed in the ‘Context Header’ lines for a difference. I can see no indication that it can be used for excluding part of whole of a line if a ; is found, or if the regex can include all or just part of the regular expression syntax. From !Help it seems that ‘Match regex’ uses the GNUdiff -F I think your best bet would be to write a litttle program which removed your assembler comments for the compare from the BASIC code. I have some very similar things if of interest. |
Ralph Barrett (1603) 154 posts |
Thanks Martin. I won’t waste my time further trying random ‘regex’ commands. But I will look further at how !SideDiff interfaces with the ‘Diff’ module. In particular I’ll investigate whether the ‘!Sed’ utility can be used. On my RPi5 I use Kdiff3 with the following Diff Settings: Preprocessor command: sed ‘s/;/\/\//’
Yes – I could update the !SideDiff !RunImage Basic programme and intercept where the filenames are entered. Create two new files (say ‘1’ and ‘2’) sans comments, and send these to ‘Diff’ for comparison. Many thanks – your comments were very helpful. Ralph |