COBOL Word Character
-
I am using IBM COBOL, where the minus is a word character and the underscore is not. How can I change the NotePad++ COBOL definition accordingly?
-
For what context do you care about whether it considers something a “word character” or not?
For Notepad++'s local usage of “word character” (double-click, smart-highlighting-requiring-whole-word and the like), it is not a language-specific setting. You can use Settings > Preferences > Delimiter to add extra characters (including the
-
minus character) – but you cannot take away any characters. And it uses the same definition for every language.That setting does not influence the regular expression “word character”
\w
definition. The regex engine just has its definition, which is unchangeable.If you are talking about something in the syntax highlighting, I am not sure I understand when “word character” would come into play.
-
@Jonathan-R ,
You’re very unclear in your question. @PeterJones is correct.It’s been a long time since I did any COBOL of any flavor, so I did a quick search on the newest IBM COBOL syntax, and apparently, yes, the hyphen(
-
) is a word character. My question, is why don’t you think that the current COBOL language is properly rendering syntax coloring, etc for COBOL, let alone IBM COBOL?Here is a screenshot of me just pasting some sample COBOL code in Notepad++, and just selecting under
Language->C->COBOL
and this screenshot shows the current colorization of that language, properly showing the hyphen as a word character.This is that code so you can try it yourself:
IDENTIFICATION DIVISION. PROGRAM-ID. VARS. DATA DIVISION. *> working storage defines variables WORKING-STORAGE SECTION. *> define a number with a sign, 3 numbers, a decimal, and then *> two numbers aafter the decimal. by default it should be 0 filled 01 FIRST-VAR PIC S9(3)V9(2). *> do the same thing as above but actually initialize *> to a number -123.45 01 SECOND-VAR PIC S9(3)V9(2) VALUE -123.45. *> defines an alphabetic string and initialize it to abcdef 01 THIRD-VAR PIC A(6) VALUE 'ABCDEF'. *> define an alphanumeric string and initialize it to a121$ 01 FOURTH-VAR PIC X(5) VALUE 'A121$'. *> create a grouped variable 01 GROUP-VAR. 05 SUBVAR-1 PIC 9(3) VALUE 337. *> create 3 alphanumerics, but use less than *> the allocated space for each of them 05 SUBVAR-2 PIC X(15) VALUE 'LALALALA'. 05 SUBVAR-3 PIC X(15) VALUE 'LALALA'. 05 SUBVAR-4 PIC X(15) VALUE 'LALALA'. *> print our variables PROCEDURE DIVISION. DISPLAY "1ST VAR :"FIRST-VAR. DISPLAY "2ND VAR :"SECOND-VAR. DISPLAY "3RD VAR :"THIRD-VAR. DISPLAY "4TH VAR :"FOURTH-VAR. DISPLAY "GROUP VAR :"GROUP-VAR. STOP RUN.
As you can see…the hyphen(
-
) is treated as a word character, and properly highlighted even when being used as minus in a numerical representation.So again, what are you really asking, because you are clear as mud.