| 1 |
/* |
| 2 |
* $Id: cobol.c 443 2006-05-30 04:37:13Z darren $ |
| 3 |
* |
| 4 |
* Copyright (c) 2000-2003, Darren Hiebert |
| 5 |
* |
| 6 |
* This source code is released for free distribution under the terms of the |
| 7 |
* GNU General Public License. |
| 8 |
* |
| 9 |
* This module contains functions for generating tags for COBOL language |
| 10 |
* files. |
| 11 |
*/ |
| 12 |
|
| 13 |
/* |
| 14 |
* INCLUDE FILES |
| 15 |
*/ |
| 16 |
#include "general.h" /* must always come first */ |
| 17 |
#include "parse.h" |
| 18 |
|
| 19 |
/* |
| 20 |
* FUNCTION DEFINITIONS |
| 21 |
*/ |
| 22 |
|
| 23 |
static void installCobolRegex (const langType language) |
| 24 |
{ |
| 25 |
addTagRegex (language, "^[ \t]*[0-9]+[ \t]+([A-Z0-9][A-Z0-9-]*)[ \t]+(BLANK|OCCURS|IS|JUST|PIC|REDEFINES|RENAMES|SIGN|SYNC|USAGE|VALUE)", |
| 26 |
"\\1", "d,data,data items", "i"); |
| 27 |
addTagRegex (language, "^[ \t]*[FSR]D[ \t]+([A-Z0-9][A-Z0-9-]*)\\.", |
| 28 |
"\\1", "f,file,file descriptions (FD, SD, RD)", "i"); |
| 29 |
addTagRegex (language, "^[ \t]*[0-9]+[ \t]+([A-Z0-9][A-Z0-9-]*)\\.", |
| 30 |
"\\1", "g,group,group items", "i"); |
| 31 |
addTagRegex (language, "^[ \t]*([A-Z0-9][A-Z0-9-]*)\\.", |
| 32 |
"\\1", "p,paragraph,paragraphs", "i"); |
| 33 |
addTagRegex (language, "^[ \t]*PROGRAM-ID\\.[ \t]+([A-Z0-9][A-Z0-9-]*)\\.", |
| 34 |
"\\1", "P,program,program ids", "i"); |
| 35 |
addTagRegex (language, "^[ \t]*([A-Z0-9][A-Z0-9-]*)[ \t]+SECTION\\.", |
| 36 |
"\\1", "s,section,sections", "i"); |
| 37 |
} |
| 38 |
|
| 39 |
extern parserDefinition* CobolParser () |
| 40 |
{ |
| 41 |
static const char *const extensions [] = { |
| 42 |
"cbl", "cob", "CBL", "COB", NULL }; |
| 43 |
parserDefinition* def = parserNew ("Cobol"); |
| 44 |
def->extensions = extensions; |
| 45 |
def->initialize = installCobolRegex; |
| 46 |
def->regex = TRUE; |
| 47 |
return def; |
| 48 |
} |
| 49 |
|
| 50 |
/* vi:set tabstop=4 shiftwidth=4: */ |