This adds the faust
filetype for Faust .dsp
and .lib
files.
The .lib
file extension was marked as being for COBOL files, but I couldn't find any evidence to support .lib
being an extension that's used by COBOL (see sources below), so I reassigned it to Faust, which does use the .lib
extension (example). If anyone can find a .lib
file in COBOL, I'll gladly write a file type detector for it, but I would need to see it in order to know what I'm detecting.
Sources proving that COBOL doesn't use .lib
:
.lib
as an extension.lib
as an extension they detect as a COBOL file..lib
files on github are all in repos that do not contain any COBOL codehttps://github.com/vim/vim/pull/14894
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
It might be a good idea to email the Cobol runtime files maintainer (Ankit Jain aja...@yahoo.co.in) and see if they can offer an explanation for this extension. It appears to have been assigned to Cobol for at least twenty five years.
Linguist doesn't recognise it as a Cobol extension either.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks. Another issue: *.dsp
is already used for Makefiles
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Yes, I just noticed that - I'll write a detector for it. It seems like checking for #
characters at the beginnings of lines, no semicolons ;
at the ends of lines, and looking for keywords like ifeq
and endif
could be a good way of doing this.
Example .dsp
in Makefile: https://github.com/alberto-fc/csr-spi-ftdi/blob/21cda76812b916bb8e31097c389fe6b82fcb8512/obj-win32/Makefile.dsp
Example .dsp
in Faust: https://github.com/magnetophon/lamb/blob/a2151cfd20c9827c92fb6fc092dc367b2b40d450/lamb.dsp
Also, I've never submitted a PR here before. Should this PR touch the same files as #12363?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@PowerUser64 I think it is safe to remove .lib from COBOL filetype detector as it is not a standard COBOL extension. Standard types are .cbl and .cob and .cpy for copybooks.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I think #12363 is a good example, which you can use as a template for you changes. Thanks for working on that.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@PowerUser64 pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
Good news, it turns out that Make doesn't actually use the .dsp
extension. Rather it's used by a discontinued program called Microsoft Developer Studio, hence the Developer Studio Project .dsp format. What's nice is these files are auto-generated, and all seem to have the same text at the top, "# Microsoft Developer Studio Project File". The format of the file is the same as that of Makefile, hence the association. I added in a few extra tests for things like keywords and comments for good measure.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@PowerUser64 pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@PowerUser64 pushed 1 commit.
You are receiving this because you are subscribed to this thread.
Cool, tests pass. By the way, any idea why https://github.com/vim/vim/actions/runs/9557808149/job/26345595245?pr=14894#step:11:15186 failed?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks, those 2 failing ones are known flaky ones.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
thanks, looks good now.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks for the review!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Just needed to fixed a local installation that use the nonstandard "lib" suffix :-) [all editors and COBOL compilers I know don't use that extension by default].
The only way I could work around that was to use --cmd
to reserve .lib for COBOL. (That way the faust definition, which does not use !
, don't override it`. Would there have been a better/cleaner way?)
A file detector would indeed be nice!
Most copybooks would start with several comment lines (1+), but those may look different depending on the dialect.
Side-note: "common" COBOL file types also include "pco" for Oracle Pro*COBOL and "sqb" for the DB2 preprocessor.
Rarely used but also seen: copy
(and of course: all of the extensions in upper-case as well).
Has anyone contacted Ankit Jain and got a response [the syntax files are kinda outdated]?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Just needed to fixed a local installation that use the nonstandard "lib" suffix :-) [all editors and COBOL compilers I know don't use that extension by default].
The only way I could work around that was to use --cmd
to reserve .lib for COBOL. (That way the faust definition, which does not use !
, don't override it`. Would there have been a better/cleaner way?)
A file detector would indeed be nice!
Most copybooks would start with several comment lines (1+), but those may look different depending on the dialect.
Side-note: "common" COBOL file types also include "pco" for Oracle Pro*COBOL and "sqb" for the DB2 preprocessor.
Rarely used but also seen: copy
(and of course: all of the extensions in upper-case as well).
Has anyone contacted Ankit Jain and got a response (the syntax files are kinda outdated)?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Good to know. Based on research, do you think searching for these words in the first 10 or so lines would detect most cobol files?
PERFORM
PROCEDURE
^[*]
(regex)I've never seen a cobol .lib file before, so I don't know what I would expect to find in one. Feel to adjust.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
PROCEDURE
would be less likely (there's only one place where you can use it), I'd drop that. DIVISION.
is similar (so I'd also not use that). They are likely to be found in COBOL programs, but we search for copybooks only (kind of #include
, just with a possible complex text replacement (not positional like macros but leading/trailing/complete words).
For comments: the *
at column 7 (standard, no matter what's in col 1-6) or column 1 (extension); less likely is *>
(free format - if this is used as "complete line" comment (that's what we look for) it is prefixed by 0 to 11 spaces (I guess that's^[ }+[*]>
).
For copybooks you will commonly see SECTION.
(non-regex), that's a good thing to add.
For "code" included there: PERFORM
... may be in, but IF
and MOVE
are much more likely.
For "declarations": it is likely best to search for PIC
, PICTURE
, USAGE
. COMP[ -.]
VALUE
(anywhere in the line), other parts are position-dependent or "too common" (USAGE and VALUE may apply there, too, not sure).
For all of those words above: case-insensitive is important.
For some "modern style" copybooks you can have a look at
https://github.com/meyfa/CobolCraft/blob/main/src/_copybooks/state/DD-SERVER-PROPERTIES.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/cobjapi/AWT/src_cobol/cobjapifn.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/cobjapi/AWT/src_cobol/cobjapi.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/worldcities/checkfilestatus.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/htm2cob/source/htm2cob8.cpy
Old style:
https://github.com/mridoni/gixsql/blob/main/copy/SQLCA.cpy
https://github.com/bmTas/JRecord/blob/master/examples/Cbl2Csv/src/test/resources/net/sf/JRecord/zData/DTAR020.cbl
https://github.com/Martinfx/Cobol/blob/master/AS400/QCBLLESRC/DUMP_FULL.CBLLE
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.