Skip to content

[plsql] Fix #6609: Parse parenthesized arithmetic comparisons - #7115

Merged
adangel merged 3 commits into
pmd:mainfrom
kalayciburak:fix-6609-parenthesized-comparison
Oct 23, 2026
Merged

adangel merged 3 commits into
pmd:mainfrom
kalayciburak:fix-6609-parenthesized-comparison

Conversation

@kalayciburak

Copy link
Copy Markdown
Contributor

Describe the PR

CompoundCondition used a one-token lookahead on (, so (NVL(a, 0) - NVL(b, 0)) > 0 was parsed as a parenthesized condition. The comparison operator sits outside those parentheses, and the parse failed with Encountered ")". A longer lookahead now treats a parenthesized expression followed by a comparison operator as a comparison.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Tests

  • JAVA_HOME=21 ./mvnw -pl pmd-plsql -am checkstyle:check test — checkstyle 0 violations; pmd-plsql 244 tests, 0 failures

A one-token lookahead on "(" treated (expr) <op> ... as a parenthesized
condition, so the comparison operator outside the parentheses failed the parse.
@pmd-actions-helper

pmd-actions-helper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-10-23 13:29:53+00:00 for b446b1f)

@UncleOwen UncleOwen added the in:grammar About the grammar of a lexer or parser, eg, a parse/lex exception label Sep 25, 2026

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@adangel adangel added this to the 7.29.0 milestone Oct 23, 2026
@adangel
adangel merged commit c5a0ebf into pmd:main Oct 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:grammar About the grammar of a lexer or parser, eg, a parse/lex exception

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plsql] Parse exception when comparing parenthesized arithmetic expression in WHERE clause

3 participants