Community
    • Login

    User Defined Language - BASIC comments

    Scheduled Pinned Locked Moved General Discussion
    user stylesfeature requestudl
    5 Posts 3 Posters 3.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Steve555S
      Steve555
      last edited by

      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.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • Claudia FrankC
          Claudia Frank @Steve555
          last edited by

          @Steve555

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

          Cheers
          Claudia

          1 Reply Last reply Reply Quote 0
          • Steve555S
            Steve555
            last edited by

            @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.

            Claudia FrankC 1 Reply Last reply Reply Quote 0
            • Claudia FrankC
              Claudia Frank @Steve555
              last edited by

              @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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors