User Defined Language - BASIC comments



  • I’ve been writing and maintaining some code for an ancient piece of hardware that is coded in a proprietary version of BASIC. Notepad++, with its UDL features, has been a godsend for making this task productive.

    One issue has been bugging me, however. This version of BASIC only supports marking comments with the REM keyword. I’ve defined a comment line style with REM as the “Open” tag. This mostly works, except it also picks up any time the letters REM appear together elsewhere in the code (including in the middle of a variable name) and thinks that’s the beginning of a comment.

    Is there any way to tell Notepad++ to require REM to appear as a standalone word in order to be recognized as a comment?

    I’m guessing the answer is “no,” in which case I’d like to make that a feature request.



  • On the Comment & Number tab of the UDL, just above where you define the Comment Line Style, there is an option Line comment position which needs to be set to ☑ Force at beginning of line.



  • @Steve555

    what about “allow preceding whitespace flag”, seems to work.

    Cheers
    Claudia



  • @PeterCJ-AtWork
    @Claudia-Frank

    Thanks for the suggestions. I tried both of those.

    Force at beginning of line doesn’t cover cases when REM is indented (not in the first column).

    Allow preceeding whitespace takes care of that, but it misses cases where REM appears at the end of a line, like this:

    LCD_Display( "Hello World" )  : REM Write text to the LCD
    

    Allow anywhere is the only option that catches all the comments, but it also catches things that aren’t comments, like:

    PressureMultiplier = 3.14159 * Infinity + 42
    

    * Real variable name in my code. Rest obviously contrived.

    The keywords lists support keywords with whitespace by enclosing them in single quotes, but that doesn’t appear to be supported for comments.



  • @Steve555

    I see what you mean - what comes into my mind is
    either you make REM unique by adding a char like semicolon,
    hopefully this is allowed by the compiler, or you make sure that
    REM is the only UPPERCASE version of the source code and disable
    IgnoreCase option.

    Cheers
    Claudia