GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
cobol

Cobol lexer cleans up dangerous trailing context warnings.

Cobol lexer rewritten to avoid dangerous trailing context warnings and improve PICTURE scanning.

The Cobol lexer has been refactored to eliminate “dangerous trailing context” warnings by restructuring how it scans PICTURE clauses. This change improves the robustness of the lexer and ensures the parser uses the new token sequence for validation. It also includes a fix for RT 3580 and removes an unnecessary include.

In Details

The COBOL front-end's lexer (scan.l) previously used ambiguous trailing context rules (r/s patterns) that triggered warnings, particularly when parsing PICTURE clauses. This commit rewrites the PICTURE scanning logic to resolve these ambiguities by scanning "rs" and then finding the end of "r" in user action, adjusting scanner state and location accordingly. The parser's validation logic has been updated to use the new lexer output.

Filed Under: cobollexerparsing