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

COBOL: Improve CDF token sameness test

COBOL parser's CDF token check now considers token location for improved accuracy.

The COBOL parser’s logic for determining if a token encountered in a lookahead was ‘the same’ as a scanned token has been improved. It now considers not only the token type but also its location, providing a more robust check for whether a specific CDF token was consumed.

In Details

This commit refines the COBOL parser's logic for detecting token sameness, specifically within the context of CDF (COBOL Deployment Facility) parsing. New functions cdf::location, same_end, and same_token are introduced in cdf.y and scan_post.h. The key improvement is that same_token now compares both the token *type* and its *location* (likely start and end positions). This enhancement makes the check more precise when determining if a CDF lookahead token was actually consumed by the parser.

For Context
CDF
COBOL Deployment Facility, a component or standard within COBOL development, likely related to deployment configurations or metadata.
lookahead token
In parsing, a token that the parser examines but has not yet fully processed. It's a preview of upcoming input.
token type
The classification of a lexical unit recognized by the lexer (e.g., identifier, keyword, operator).
location
In parsing contexts, this typically refers to the position in the source file, such as line number and column, or a character offset, indicating where a token was found.
Filed Under: cobolparserlexercompiler internals