Will someone who reads and understands vim files please tell me
which line or lines to change? The way it is now I am forced to
turn off syntax checking just to read/edit the file in Gvim.
--
John Culleton
Free list of books for self-publishers:
http://wexfordpress.net/shortlist.html
"Create Book Covers with Scribus"
http://www.booklocker.com/books/4055.html
> In the cobol.vim file, something causes all sentences starting
> with "if" to be colored red just like an error. The "if" verb is
> perfectly legitimate in COBOL, I have used it since 1968.
I haven't been using it for *quire* that long, but I agree with you that it is perfectly legal!
I have had odd syntax colouring in COBOL files at beginning of lines on occasion, but it always turns out to be the presence of a 'tab' character instead of leading spaces that makes text that *looks* like it is in column 12 actually start to the left of that, in area A, or even in the line number field.
Not saying that is your problem here, but it's worth a look.
Regards, Andy
--
Andrew Long
andrew dot long at mac dot com
Thanks for your reply. I don't use tabs when writing COBOL for
just that reason. It is only the reserved word "IF" or "if" that causes
the problem. I understand that there was an improved syntax file
from a site belonging to Sitaram but that seems to have been
taken over by someone selling insurance.
I can try hacking the existing cobol.vim file but I don't know
the intricacies of vim syntax files. I thought someone here could
help.
I'll try writing Tim Pope.
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.
i saved this email as utl022.cbl, deleted the parts not cobol,
and the parts you say are flagged as errors are not flagged for
me -- the only thing in mine that's flagged as an error is the
tab character in front of the '02' in the 2nd FILLER field of
PRINTLINE
my syntax module cobol.vim has a 7th line containing:
" $Id: cobol.vim,v 1.2 2007/05/05 18:23:43 vimboss Exp $
is that the same as yours?
sc
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
Yes, they are identical. It is possible that my cobol.vim is
corrupt. I will try downloading and reinstalling vim.
> Hi john!
>
> :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
>
Well I write in COBOL 85 in the traditional fixed format. See my
previous example.
I started with pre-COBOL 68, in 1968. The IF statement and the
AT END statements were legal then and still are legal in all the
compilers I have used. I am reasonably certain they were legal
in the very first COBOL compiler written by Grace Murray Hopper
and her crew. So there is a fault in cobol.vim. Yes, I
have cobol_legacy_code set. That should not cause IF and END to
be highlighted as errors. There is a problem with cobol.vim, like
it or not.
If I unset cobol_legacy_code, IF no longer causes errors. But line
numbers in columns 1-6 are now highlighted as errors.
I upgraded to vim 7.3 but still have the same error.
I will try disabling my .vimrc file and see if that helps.
On Mi, 15 Feb 2012, john Culleton wrote:
> On Wed, 15 Feb 2012 08:48:49 +0100 Christian Brabandt
> <cbl...@256bit.org> wrote:
>
> > Hi john!
> >
>
> > :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
> >
> Well I write in COBOL 85 in the traditional fixed format. See my
> previous example.
>
> I started with pre-COBOL 68, in 1968. The IF statement and the
> AT END statements were legal then and still are legal in all the
> compilers I have used. I am reasonably certain they were legal
> in the very first COBOL compiler written by Grace Murray Hopper
> and her crew. So there is a fault in cobol.vim.
Be it a fault or not, it is configurable. As I don't know Cobol, I can't
judge. But I wouldn't call it a bug yet.
> Yes, I have cobol_legacy_code set. That should not cause IF and END to
> be highlighted as errors.
I don't know whether it should or not highlight it as errors and I
really don't care. But this is the way it is in the syntax file and you
*can* configure it.
So maybe, just configure it and don't complain here about IF and END
being allowed in Cobol or not.
> There is a problem with cobol.vim, like it or not.
I couldn't care less. I am just trying to help *you*. Seems, you don't
want my help.
> If I unset cobol_legacy_code, IF no longer causes errors.
See, it works.
> But line numbers in columns 1-6 are now highlighted as errors.
Now this could be an error. I think you want to discuss this with the
maintainer of the syntax file. But also this behaviour can be
configured:
Create a file ~/.vim/after/syntax/cobol and create non-existing
directories and in there put
hi link CobolMarker Comment
Like it or not, it is all configurable and I don't see an error here.
However if you want to complain about something, just discuss this with
the maintainer of the syntax file or simply create your own better
syntax file.
regards,
Christian
--
> On Feb 16, 10:26 am, john Culleton <J...@wexfordpress.com> wrote:
> >
> > I started with pre-COBOL 68, in 1968. The IF statement and the
> > AT END statements were legal then and still are legal in all the
> > compilers I have used. I am reasonably certain they were legal
> > in the very first COBOL compiler written by Grace Murray Hopper
> > and her crew. So there is a fault in cobol.vim. Yes, I
> > have cobol_legacy_code set. That should not cause IF and END to
> > be highlighted as errors. There is a problem with cobol.vim, like
> > it or not.
>
> (Hey, we're friendlier than that here. Such belaboured sarcasm may
> not be appreciated.)
Well I did what I swore I wouldn't do, hacked the cobol.vim file
blindly. I inserted the keywords IF and END in the big list of
COBOL reserved words. Now it works, at least enough to satisfy me.
I left in the line:
syn match cobolReserved contained "\<\(IF\|INVALID\|END\|EOP\)\>"
I have no idea what it does, but apparently it does no harm.
Thanks to all who replied. If anyone wants a copy of my hacked
cobol.vim just drop me a line.
--
John Culleton
On Do, 16 Feb 2012, john Culleton wrote:
> On Wed, 15 Feb 2012 16:38:47 -0800 (PST)
> John Little <john.b...@gmail.com> wrote:
>
> > On Feb 16, 10:26�am, john Culleton <J...@wexfordpress.com> wrote:
> > >
> > > I started with pre-COBOL 68, in 1968. �The IF statement and the
> > > AT END statements were legal then and still are legal in all the
> > > compilers I have used. �I am reasonably certain they were legal
> > > in the very first COBOL compiler written by Grace Murray Hopper
> > > and her crew. � So there is a fault in cobol.vim. Yes, I
> > > have cobol_legacy_code set. That should not cause IF and END to
> > > be highlighted as errors. There is a problem with cobol.vim, like
> > > it or not.
> >
> > (Hey, we're friendlier than that here. Such belaboured sarcasm may
> > not be appreciated.)
>
> Well I did what I swore I wouldn't do, hacked the cobol.vim file
> blindly. I inserted the keywords IF and END in the big list of
> COBOL reserved words. Now it works, at least enough to satisfy me.
> I left in the line:
You wouldn't have to. I told you, how to configure it properly. I hope,
you didn't modify the file in $VIMRUNTIME directly:
http://vimhelp.appspot.com/vim_faq.txt.html#faq-36.11
regards,
Christian
--