skip to main content

Compiler and Runtime : Compiler : Source code preprocessing

Source code preprocessing
The isCOBOL Compiler offers the ability to preprocess COBOL source files through regular expressions.
This feature is activated by the configuration property iscobol.compiler.regexp. If the property is not set, then no preprocessing is performed. If the property is set, then the source code is preprocessed at compile time.
The property iscobol.compiler.regexp can be set to one or more pairs of strings enclosed between double quotes, in the format:
Each pair of strings identifies a replacement that will be applied to the source before the Compiler processes it.
The first string of each pair is a match string and must respect Java specifications (http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html ).
Note: The backslash character (\), if used, must be doubled due to the property file format.
The second string of each pair is the replacement string. Every time the first string matches it is replaced by the second string.
Regular expressions are resolved sequentially in the order they appear in the iscobol.compiler.regexp value for every line of code. More than one replacement might be performed on the same line; for example, having the following setting:
the text AXAB will be transformed in ABCD (ABAB after the first replacement and ABCD after the second replacement, that is applied on the result of the first).
Note - Replacements affect all the text in the source code, including string literals.
Examples
Example - The following regexp replaces STOP RUN by GOBACK without case sensivity and regardless of how many spaces are between STOP and RUN.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left