Kaydet (Commit) 585b16b0 authored tarafından Colomban Wendling's avatar Colomban Wendling

COBOL: Import new upstream candidate parser

This fixes support for COBOL symbols after the recent breakage of regex
parsers, as well as introducing additional features and bug fixes.

Also import some of the tests.

https://github.com/universal-ctags/ctags/pull/2076

Part of #2119.
üst acebc2d6
This diff is collapsed.
...@@ -490,10 +490,12 @@ static void add_top_level_items(GeanyDocument *doc) ...@@ -490,10 +490,12 @@ static void add_top_level_items(GeanyDocument *doc)
tag_list_add_groups(tag_store, tag_list_add_groups(tag_store,
&tv_iters.tag_class, _("Program"), ICON_CLASS, &tv_iters.tag_class, _("Program"), ICON_CLASS,
&tv_iters.tag_function, _("File"), ICON_METHOD, &tv_iters.tag_function, _("File"), ICON_METHOD,
&tv_iters.tag_interface, _("Divisions"), ICON_NAMESPACE,
&tv_iters.tag_namespace, _("Sections"), ICON_NAMESPACE, &tv_iters.tag_namespace, _("Sections"), ICON_NAMESPACE,
&tv_iters.tag_macro, _("Paragraph"), ICON_OTHER, &tv_iters.tag_macro, _("Paragraph"), ICON_OTHER,
&tv_iters.tag_struct, _("Group"), ICON_STRUCT, &tv_iters.tag_struct, _("Group"), ICON_STRUCT,
&tv_iters.tag_variable, _("Data"), ICON_VAR, &tv_iters.tag_variable, _("Data"), ICON_VAR,
&tv_iters.tag_externvar, _("Copies"), ICON_NAMESPACE,
NULL); NULL);
break; break;
case GEANY_FILETYPES_CONF: case GEANY_FILETYPES_CONF:
......
...@@ -423,11 +423,13 @@ static TMParserMapEntry map_R[] = { ...@@ -423,11 +423,13 @@ static TMParserMapEntry map_R[] = {
static TMParserMapEntry map_COBOL[] = { static TMParserMapEntry map_COBOL[] = {
{'d', tm_tag_variable_t}, {'d', tm_tag_variable_t},
{'D', tm_tag_interface_t},
{'f', tm_tag_function_t}, {'f', tm_tag_function_t},
{'g', tm_tag_struct_t}, {'g', tm_tag_struct_t},
{'p', tm_tag_macro_t}, {'p', tm_tag_macro_t},
{'P', tm_tag_class_t}, {'P', tm_tag_class_t},
{'s', tm_tag_namespace_t}, {'s', tm_tag_namespace_t},
{'S', tm_tag_externvar_t},
}; };
static TMParserMapEntry map_OBJC[] = { static TMParserMapEntry map_OBJC[] = {
...@@ -768,6 +770,7 @@ gboolean tm_parser_has_full_context(TMParserType lang) ...@@ -768,6 +770,7 @@ gboolean tm_parser_has_full_context(TMParserType lang)
case TM_PARSER_C: case TM_PARSER_C:
case TM_PARSER_CPP: case TM_PARSER_CPP:
case TM_PARSER_CSHARP: case TM_PARSER_CSHARP:
case TM_PARSER_COBOL:
case TM_PARSER_D: case TM_PARSER_D:
case TM_PARSER_FERITE: case TM_PARSER_FERITE:
case TM_PARSER_GLSL: case TM_PARSER_GLSL:
......
dist_check_SCRIPTS = runner.sh dist_check_SCRIPTS = runner.sh
# Disabled tests:
# simple.cbl
NULL = NULL =
test_sources = \ test_sources = \
1795612.js \ 1795612.js \
...@@ -117,6 +114,11 @@ test_sources = \ ...@@ -117,6 +114,11 @@ test_sources = \
case_sensitivity.php \ case_sensitivity.php \
char-selector.f90 \ char-selector.f90 \
classes.php \ classes.php \
cobol/helloworld.cbl \
cobol/helloworld2.cbl \
cobol/levels.cbl \
cobol/quoted-program-id.cbl \
cobol/simple.cbl \
common.f \ common.f \
complex-return.js \ complex-return.js \
continuation.f90 \ continuation.f90 \
......
00000* VALIDATION OF BASE COBOL INSTALL 00050000
01000 IDENTIFICATION DIVISION. 00060000
01100 PROGRAM-ID. 'HELLO'. 00070000
02000 ENVIRONMENT DIVISION. 00080000
02100 CONFIGURATION SECTION. 00090000
02110 SOURCE-COMPUTER. GNULINUX. 00100000
02120 OBJECT-COMPUTER. HERCULES. 00110000
02200 SPECIAL-NAMES. 00120000
02210 CONSOLE IS CONSL. 00130000
03000 DATA DIVISION. 00140000
04000 PROCEDURE DIVISION. 00150000
04100 00-MAIN. 00160000
04110 DISPLAY 'HELLO, WORLD' UPON CONSL. 00170000
04900 STOP RUN. 00180000
# format=tagmanager
00-MAIN655360
CONFIGURATION2560
DATA320
ENVIRONMENT320
HELLO10
IDENTIFICATION320
OBJECT-COMPUTER655360
PROCEDURE320
SOURCE-COMPUTER655360
SPECIAL-NAMES655360
00000* VALIDATION OF BASE COBOL INSTALL
IDENTIFICATION DIVISION.
01100 PROGRAM-ID. 'HELLO WORLD'.
02000 ENVIRONMENT DIV
-ISION.
02100 CONFIGURATION SECTION.
02110 SOURCE-COMPUTER. GNULINUX.
02120 OBJECT-COMPUTER. HERCULES.
02200 SPECIAL
--NAMES.
02210 CONSOLE IS CONSL.
03000 DATA DIVISION.
04000 PROCEDUR
- E DIVISION.
04100 00-MAIN.
04110 DISPLAY
'HELLO, WORLD'
UPON CONSL.
04900 STOP RUN.
# format=tagmanager
00-MAIN655360
CONFIGURATION2560
DATA320
ENVIRONMENT320
HELLO WORLD10
IDENTIFICATION320
OBJECT-COMPUTER655360
PROCEDURE320
SOURCE-COMPUTER655360
SPECIAL-NAMES655360
IDENTIFICATION DIVISION.
PROGRAM-ID. Test-Items.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RECORD1.
05 ITEM1 PIC X(1).
05 ITEM2 PIC A(1).
88 ODD VALUES 1, 3, 5, 7, 9.
88 EVEN VALUES 2, 4, 6, 8.
05 ITEM3 PIC X(6).
66 RDITEM4 RENAMES ITEM1 THRU ITEM2.
66 RDITEM5 RENAMES ITEM1 THROUGH ITEM3.
77 STDLN1 PIC A(4).
01 REC2.
02 G1.
05 ITEM1 PICTURE X(10).
05 ITEM2 PIC X(10).
66 OTHERNAME1 RENAMES ITEM1 IN REC2.
66 OTHERNAME2 RENAMES G1.
PROCEDURE DIVISION.
MAIN-PROCEDURE.
DISPLAY "Hello world".
DISPLAY OTHERNAME2.
STOP RUN.
END PROGRAM Test-Items.
# format=tagmanager
DATA320
EVEN16384RECORD1.ITEM20
G12048REC20
IDENTIFICATION320
ITEM116384REC2.G10
ITEM116384RECORD10
ITEM216384REC2.G10
ITEM216384RECORD10
ITEM316384RECORD10
MAIN-PROCEDURE655360
ODD16384RECORD1.ITEM20
OTHERNAME116384REC20
OTHERNAME216384REC20
PROCEDURE320
RDITEM416384RECORD10
RDITEM516384RECORD10
REC220480
RECORD120480
STDLN1163840
Test-Items10
WORKING-STORAGE2560
IDENTIFICATION DIVISION.
PROGRAM-ID. 'Test program name'.
PROCEDURE DIVISION.
MAIN.
DISPLAY 'This is a test program'.
STOP RUN.
END PROGRAM 'Test program name'.
# format=tagmanager
IDENTIFICATION320
MAIN655360
PROCEDURE320
Test program name10
# format=tagmanager # format=tagmanager
AUTHOR655360 AUTHOR655360
Begin655360 Begin655360
DW-DAYS-IN-MONTH163840 DATA320
DW-DAYS-IN-MONTHS163840 DW-DAYS-IN-MONTH16384Group-Name.Data-Item1.DW-DAYS-IN-MONTHS0
Data-Item1163840 DW-DAYS-IN-MONTHS16384Group-Name.Data-Item10
Data-Item116384Group-Name0
ENVIRONMENT320
FILE2560 FILE2560
FILE-CONTROL655360 FILE-CONTROL655360
File-Data-Item163840 File-Data-Item16384File-Group-Name0
File-Group-Name20480 File-Group-Name20480
File-Name160 File-Name160
Group-Name20480 Group-Name20480
IDENTIFICATION320
INPUT-OUPUT2560 INPUT-OUPUT2560
PROGRAM-ID655360 PROCEDURE320
Program-Name10 Program-Name10
SH-WORK-MMDDYYYY163840 SH-WORK-MMDDYYYY16384Group-Name.Data-Item10
SH-WORK-MMDDYYYY-2163840 SH-WORK-MMDDYYYY-216384Group-Name.Data-Item10
Subprogram-Name655360 Subprogram-Name655360
WORKING-STORAGE2560 WORKING-STORAGE2560
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment