Remove Remarks for Programs - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Utilities (https://qb64phoenix.com/forum/forumdisplay.php?fid=8) +---- Thread: Remove Remarks for Programs (/showthread.php?tid=3169) Pages:
1
2
|
RE: Remove Remarks for Programs - Pete - 10-26-2024 I updated mine and included a test file. I'm old school, that's for sure. I do love the new QB64 features that cut out a lot of code but I'm just set in may ways about coding the routines from scratch. It's all I can do to stop myself from just writing the routine in machine code! j/k. Only did that headache once. Steve, if you run my test code with your routine, you will see you need to add a few things... Test file results after running Steve's routine... --------------------------------------------------------------------------- Rem $Dynamic Print " ' this should not be removed. Rem 123" rem this should be removed. a$ = "apple": b$ = "orange": Rem orange c$ = "pear" d$ = "banana" Rem banana Rem line 3 Data don Data "don't" Data "don't": Data "don't": Rem remark. Data don Data don --------------------------------------------------------------------------- Test file results after running Pete's routine... --------------------------------------------------------------------------- ' $Dynamic Rem $Dynamic Print " ' this should not be removed. Rem 123" a$ = "apple" b$ = "orange" c$ = "pear" d$ = "banana" Data don't Data "don't" Data "don't" Data "don't" Data don't ' remark is part of data and should stay. Data don't rem remark is part of data and should stay, too. ---------------------------------------------------------------------------- The test file is posted in post #1, but I'll repost it here so it's easy to see Test file -------------------------- ' $Dynamic Rem $Dynamic ' Simple rem line. ' "***": for i = 1 to 5 Print " ' this should not be removed. Rem 123" rem this should be removed. a$ = "apple": ' apple b$ = "orange": Rem orange c$ = "pear" ' pear d$ = "banana" Rem banana ' line 1 ' line 2 Rem line 3 Data don't Data "don't" Data "don't": ' remark. Data "don't": Rem remark. Data don't ' remark is part of data and should stay. Data don't rem remark is part of data and should stay, too. --------------------------------------------------------------------------- The random indentations were made to make sure the routines can handle indenting. If you guys find any errors in mine, let me know. There's a good chance I may have missed something. Actually Steve got ' $ for meta commands, and I added Rem $, which was also used back in the day. I love it that forums provide more hands on deck to make improving a project easier. Thanks guys, Pete RE: Remove Remarks for Programs - SMcNeill - 10-26-2024 I didn't code mine to look for REM or DATA at all. I figure those are generally edge cases and not something which I tend to code into my own stuff very often. If DATA has colons in it, then they should be inside quotes, INHO. If not, then you're ust asking for troubles. It'd be easy enough to expand upon, if one needed to, but I think it does everything I need for my personal use. Personally, I think before I tried to remove remarks from code like you're testing, I'd first do a simple Find-and-Replace for " REM " and replace that with " ' ". RE: Remove Remarks for Programs - Pete - 10-26-2024 Basically that replace Rem with ' is what mine is essentially doing. Now back in the day, we were a pretty tough bunch. Find one little oopsie in a routine and 10 members were eating your lunch! Ah, the good ol' days. No participation trophies. Okay, I'll comprise, for our kids sake: @Dimster, here is a combo of Pete and Steve's remark remover. It uses Steve's new age QB64 cool way to look up your file, with my remove remarks code. It's EXCELLENT! Code: (Select All)
Well, it beats the hell out of anything Bill (Sheldon) and Ted (Clippy) could ever put together. Pete For Phil. Rem/Unrem any of the last few lines for how you would like to gain access to the new file. RE: Remove Remarks for Programs - PhilOfPerth - 10-26-2024 (10-26-2024, 11:03 PM)Pete Wrote: Basically that replace Rem with ' is what mine is essentially doing. Very nice! But it would be nicer if it told you it was successful, and the name of the new file. I was looking at the one created prevously (by Steve's version), not realizing it had a different name, and could see no improvements.. RE: Remove Remarks for Programs - Pete - 10-26-2024 @PhilOfPerth Well, there's at least one of that ******* tough crowd from days past I mentioned. Okay, okay, okay... Now it opens the new code in the QB64 IDE. Pete RE: Remove Remarks for Programs - Dimster - 10-27-2024 Steve - I make the change to line 26 as you suggested but now getting an invalid name error on that line. I believe the old line 26 simply read "Print #2, o$". Is that correct? Pete - not sure what I'm doing wrong but seems I'm constantly getting "File Not Found". Something seems to be off with path? RE: Remove Remarks for Programs - SMcNeill - 10-27-2024 (10-26-2024, 09:42 PM)SMcNeill Wrote: Change line 26 to: (10-27-2024, 12:49 PM)Dimster Wrote: Steve - I make the change to line 26 as you suggested but now getting an invalid name error on that line. I believe the old line 26 simply read "Print #2, o$". Is that correct? Invalid name is correct, as I can't type on the iPad worth a hoot at 2am. Try this: If _TRIM$(o$) <> "" _OrElse temp$ = "" Then Print #2, o$ Whole version with the change to completely eliminate those extra lines for you: Code: (Select All)
RE: Remove Remarks for Programs - Dimster - 10-27-2024 Like a charm Steve, like a charm. Cleans a programs' comments up so nicely. |