TechCodeGeneration - TypeCobolTeam/TypeCobol GitHub Wiki

Work in progress to explain all cases that CodeGen must handle

The need:

  1. The generated code must look as close to the source file

    • For a Cobol 85 source file, the generated code must be exactly the source file

Cases

Category

Antlr

What should be done for Alpha

Blank line

No

Create a Node and a CodeElement for the whole line

Debug line

No

Currently Debugging mode is not possible. Create a Node and a CodeElement for the whole line

Compiler directive on a single line with no other CE

Yes

Parsed by Antlr but no matching CE or Node. Create a Node and a CodeElement for the whole line.

Compiler directive on a multiple line with no other CE

Yes

Parsed by Antlr but no matching CE or Node. Create a Node and a CodeElement for all lines.

Category

Input code

Generated code

Blank line

* This is a comment line

Exactly as input

* This is a comment line

Debug line

D This is a Debug line

Exactly as input

D This is a Debug line

Compiler directive

D This is a Debug line

Exactly as input

D This is a Debug line

Compiler directive on a single line with no other Cobol code

replace ==:a:== by ==b==.

Exactly as input

replace ==:a:== by ==b==.

Compiler directive on multiple lines with no other Cobol code

replace ==:a:== 
        by ==b==.

Exactly as input

replace ==:a:== 
        by ==b==.

Compiler directive on a single with other Cobol code

01 MyData. COPY MyCopy.

Exactly as input

01 MyData. COPY MyCopy.

Compiler directive on multiple lines with other Cobol code

01 MyData. COPY 
   MyCopy.

Exactly as input

01 MyData. COPY 
   MyCopy.

Rules:

  1. If a CobolTextLine only contains CodeElement/Node with an LanguageLevel input equals to LanguageLevel output then the line is copied as is (eg. if CobolTextLine only contains Cobol 85 CE/Node, then the line is copied as is).

⚠️ **GitHub.com Fallback** ⚠️