Tuesday, February 14, 2012

Re: Change needed in cobol.vim syntax file.

Hi john!

On Di, 14 Feb 2012, john Culleton wrote:

> On Tue, 14 Feb 2012 15:39:01 -0800 (PST)
> John Little <john.b.little@gmail.com> wrote:
>
> > On Feb 14, 1:02 pm, john Culleton <J...@wexfordpress.com> wrote:
> > > In the cobol.vim file, something causes all sentences starting
> > > with "if" to be colored red just like an error.
> >
> > Any chance of sending us some valid cobol showing the problem? Or
> > uploading it somewhere we can get it from? That would multiply
> > enormously those who cqn help.
> >
> > I expect that some kind of cobol-85 or cobol-90 mode has been turned
> > on and the if has no matching end-if.
> >
> > Regards, John
> >
>
>
> Well it is both the reserved word IF and the reserved word END that causes the
> problem. And to my knowledge END-IF is not required in COBOL 85.
>
> I tried adding an END-IF but the error remained.
>
> Here is a brief program that shows both problems:
> ----------------------------------
>
> 000010 IDENTIFICATION DIVISION.
> 000020 PROGRAM-ID. utl022.
> 000030 AUTHOR. JOHN CULLETON.
> 000040 INSTALLATION. WEXFORDPRESS
> 000045 Eldersburg MD.
> 000047*SECURITY. Copyright 2006 John R. Culleton, Jr.
> 000050*REMARKS. Displays program file..
> 000070 ENVIRONMENT DIVISION.
> 000080
> 000090 CONFIGURATION SECTION.
> 000100 SOURCE-COMPUTER.
> 000110 Linux.
> 000120 OBJECT-COMPUTER.
> 000230 Linux.
> 000140
> 000150 INPUT-OUTPUT SECTION.
> 000160 FILE-CONTROL.
> SELECT PROGFILE ASSIGN TO "prog"
> ORGANIZATION IS INDEXED ACCESS IS DYNAMIC
> RECORD KEY IS PROGNAME
> ALTERNATE RECORD KEY IS PARNAME
> WITH DUPLICATES.
>
>
> 000180 DATA DIVISION.
> 000190
> 000200 FILE SECTION.
> FD PROGFILE.
> 01 PROGREC.
> 02 PROGNAME PICTURE X(6).
> 02 PROGNAMM REDEFINES PROGNAME PICTURE X(6).
> 02 PARNAME PICTURE X(6).
> 02 PARNAMM REDEFINES PARNAME PICTURE X(6).
> 02 LEVNO PICTURE 9.
> 02 DEFINITION PICTURE X(58).
> 000220 WORKING-STORAGE SECTION.
> 000230 77 END-INPUT-FLAG PICTURE X VALUE "N".
> 88 END-INPUT VALUE "Y".
> 000230 77 INVALID-FLAG PICTURE X VALUE "N".
> 88 IND-INPUT VALUE "Y".
> 01 PRINTLINE.
> 02 PROGNAMM PICTURE X(6).
> 02 FILLER PICTURE X VALUE SPACE.
> 02 PARNAMM PICTURE X(6).
> 02 FILLER PICTURE X VALUE SPACE.
> 02 LEVNO PICTURE 9.
> 02 FILLER PICTURE X VALUE SPACE.
> 02 DEFINITION PICTURE X(50).
>
> 000240 PROCEDURE DIVISION.
> 000250 001-MAIN-PROCEDURE.
> OPEN INPUT PROGFILE.
> PERFORM 100-LOOP UNTIL END-INPUT.
> CLOSE PROGFILE.
> 000270 STOP RUN.
> 100-LOOP.
> READ PROGFILE NEXT RECORD AT END MOVE "Y" TO END-INPUT-FLAG.
> IF NOT END-INPUT PERFORM 200-PROCESS.
> 200-PROCESS.
> DISPLAY PROGREC.
> MOVE CORRESPONDING PROGREC TO PRINTLINE.
> DISPLAY PRINTLINE.
> ---------------------------------------------
> Both lines in the paragraph 100-LOOP are highlighted. The first
> such line is highlighted from the word END to the period.
> The second line is highlighted from the word IF to the period. There
> is only one syntax file for COBOL, cobol.vim. There is also an indent
> file named cobol.vim but I don't see an indent problem.

Do you have somehow legacy highlighting enabled? This seems only to
happen, if I set in my .vimrc:

:let cobol_legacy_code = 1

See, if this variable exists in your cobol file and enter:

:echo cobol_legacy_code

If you don't get an error, simply unlet that varible:

:unlet cobol_legacy_code

and do a

:filetype detect

The highlighting should than vanish. You then need to find out, where
you set this variable (I suspect either in your .vimrc, in a
ftplugin/cobol.vim or even after/ftplugin/cobol.vim file)

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: