I am somewhat ashamed to admit that I repeatedly used the # character to comment out lines of my buspirate scripts. Ok, technically, these are just text files on the host that I copy/paste from… I’m not using the scripting functionality yet). Of course, that doesn’t comment out the line like I hope…
since the # character is the command to reset the buspirate .
This began my search for way to enable scripts (and other command-line input) to have inline comments. I think this could also help with the documentation screencasts, such as having the chapter headers also shown as typed-in comments, as the chapter headings are not always clearly visible in the documentation playback.
Review of common programming language options:
Generally, it should avoid conflicting with the first character of any existing valid commands. This excludes the following characters:
aAbcdfFgGhilLmopPrstvVwW0-9@#$^(-_.:=~[]{}"/\
zZ if added as global command to transition to HiZ mode
Not available
Ada style -- … bus syntax conflict (data high)
AppleScript (* … script selection conflict
C++ // … bus syntax conflict (clock high)
C /* .... */ … bus syntax conflict (clock high)
Haskell {- ... -} … bus syntax conflict (start 2)
Java /** .... */ … bus syntax conflict (clock high)
Java // … bus syntax conflict (clock high)
LUA --[[ ... ]]-- … bus syntax conflict (data high)
but lowercase c conflicts, so undesirable because it would mean case-sensitive commenting
also, Fortran knowledge is less common
MATLAB %
While % is not currently used, may want to keep this for future expansion of bus syntax?
BASIC and Windows command scripts rem
Conflicts with r bus syntax
But already have rm (storage) command … so possible?
Broadly understood to comment a single line
Recommendation
I thus propose that rem be added as a global command.
UPDATE: Ian approved changing # to be named reboot, which will allow # to comment out the remaining line of input.
The remnew # command might log the line (e.g., to log files and/or debugger), and is generally for documentation purposes only … no functional effects should rely on this command.
How about we change the command to reset? The single character command is a legacy of Bus Pirate v3.x, which wasn’t really capable of parsing multiple character commands.
I seem to recall that one of the BP3 firmware builds included a BASIC interpreter as part of the language/
Crazy talk here… Or future idea…
If the syntax was modified so that each line would start with a number (or to be more precise, no existing command starts with a number and a space) , then it would be possible in the future to have the “number space” prefix tell the BP to store the instruction in memory without execution.
Add a few more commands, ala the BASIC interpreter, the LIST, LOAD and SAVE commands,and the REM command and bingo - you have the ability to edit and document scripts directly on the BP.
Good observation. It seems like we discussed it but didn’t complete that part.
How should the functionality work?
# is a command that does nothing
# is a command that prints the comment to terminal. This would require updates to the handling of scripts and macros. It would be redundant on the command line though, the comment would print twice. I think the new parser has a “consume all trailing text” function.
# does something else (log to file mentioned above)
The most basic functionality to be very useful would be to simply ignore console input lines that begin with #, next sophistication would be to ignore the first unquoted # on a line and the rest of the line.
Added but not tested due to an array of sudden vscode issues. (Aside from losing all the toolchains, it decided to look like a vape shop while doing so).