module lang::cobol85::\syntax::IdentificationDivision
The IDENTIFICATION DIVISION header and its optional paragraphs with comment entries.
Usage
import lang::cobol85::\syntax::IdentificationDivision;
Dependencies
extend lang::cobol85::\syntax::Expression;
Description
This module defines the start of a program: the IDENTIFICATION (or ID) DIVISION header followed by the optional
paragraphs AUTHOR, INSTALLATION, DATE-WRITTEN, DATE-COMPILED, SECURITY and REMARKS. Their contents are comment
entries, free text that may span several lines, which the grammar keeps as lines of words up to the margin, so the
margin itself stays layout. A comment-entry line in Area B may start with a word that is also a paragraph or
division header, because real headers start in Area A; the first word of a line stops at a period so that a header
such as AUTHOR. is still recognized. The PROGRAM-ID paragraph itself is part of the program rules in the Program
module.
syntax IdentificationDivisionContent
syntax IdentificationDivisionContent = identificationDivisionPhrase: IdentificationDivisionPhrase*;
syntax IdentificationDivisionPhrase
syntax IdentificationDivisionPhrase
= security: 'SECURITY' "."? MetaDataContentLine*
| dateCompiled: 'DATE-COMPILED' "."? MetaDataContentLine*
| author: 'AUTHOR' "."? MetaDataContentLine*
| dateWritten: 'DATE-WRITTEN' "."? MetaDataContentLine*
| remarks: 'REMARKS' "."? MetaDataContentLine*
| installation: 'INSTALLATION' "."? MetaDataContentLine*
;
syntax MetaDataContentLine
lexical MetaDataContentLine
= Word \ NoIDKeyword ![\n\uE000]* !>> ![\n\uE000]
// headers start in Area A (columns 8-11), so a comment-entry line in Area B (at least 5 spaces before it, after
// the margin and the indicator column) can start with a header word, as in `PROCEDURE BUILDS THE EIGHT-RECORD FILE`
| " " << NoIDKeyword !>> [a-zA-Z0-9\"()\-] ![\n\uE000]* !>> ![\n\uE000]
;
syntax Word
lexical Word = ![\ \t\n.*/\uE000] ![\ \t\n.\uE000]* !>> ![\ \t\n.\uE000];
syntax NoIDKeyword
keyword NoIDKeyword
= 'DATE-WRITTEN'
| 'SECURITY'
| 'DATE-COMPILED'
| 'REMARKS'
| 'INSTALLATION'
| 'AUTHOR'
| 'ENVIRONMENT'
| 'DATA'
| 'PROCEDURE'
;
syntax Identification
syntax Identification
= id: 'ID'
| identification: 'IDENTIFICATION'
;
syntax CobwordKeywords
keyword CobwordKeywords
= 'AUTHOR'
| 'DATA'
| 'DATE-COMPILED'
| 'DATE-WRITTEN'
| 'ENVIRONMENT'
| 'ID'
| 'IDENTIFICATION'
| 'INSTALLATION'
| 'PROCEDURE'
| 'REMARKS'
| 'SECURITY'
;