Skip to content

Fix duplicate END check in ComponentPascalLexer.analyse_text#3032

Merged
birkenfeld merged 1 commit intopygments:masterfrom
daniel7an:fix/issue-3028-component-pascal-analyse
Feb 20, 2026
Merged

Fix duplicate END check in ComponentPascalLexer.analyse_text#3032
birkenfeld merged 1 commit intopygments:masterfrom
daniel7an:fix/issue-3028-component-pascal-analyse

Conversation

@daniel7an
Copy link
Copy Markdown
Contributor

Summary

Fix the duplicate 'END' in text check in ComponentPascalLexer.analyse_text.

Problem

The analyse_text method checks for 'END' twice (lines 114 and 118), making the second check redundant. This means the method awards +0.02 for END but only +0.01 for BEGIN and PROCEDURE, which is unintentional.

Fix

Replace the second 'END' check with 'MODULE', since Component Pascal programs are structured as MODULE ... END blocks, making it a natural and distinctive keyword to check for.

Fixes #3028

The analyse_text method checked for 'END' twice, making the second
check redundant. Replace the duplicate with 'MODULE', which is another
common Component Pascal keyword (programs are wrapped in MODULE...END).

Fixes #3028
@birkenfeld
Copy link
Copy Markdown
Member

LGTM, thanks!

@birkenfeld birkenfeld merged commit a96a71c into pygments:master Feb 20, 2026
29 of 30 checks passed
@Anteru Anteru added this to the 2.20.0 milestone Mar 26, 2026
@Anteru Anteru added the A-lexing area: changes to individual lexers label Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component Pascal analyse_text logic

3 participants