From aeed191648d35b95a6767911b7624a9925dfa525 Mon Sep 17 00:00:00 2001 From: Joshua Gardner Date: Thu, 30 Jul 2026 10:05:32 +1000 Subject: [PATCH] Fixed parsing of logical lines with sequential `<` and `>` comparisons This change resets the `generic_level` when a new line is created. This ensures that between lines, there are no interactions between `<` and `>` operations. --- CHANGELOG.md | 4 ++++ core/CHANGELOG.md | 4 ++++ core/datatests/generators/logical_line_parser.rs | 7 ++++++- core/src/defaults/parser.rs | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0fd6476..d813eb72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed + +- Fixed parsing of logical lines with sequential `<` and `>` comparisons. + ### Added - Added support for Delphi 13 `noreturn` directive. diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 163f76c8..d55c4419 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +- Fixed parsing of logical lines with sequential `<` and `>` comparisons. + ### Added - Added support for Delphi 13 `noreturn` directive. diff --git a/core/datatests/generators/logical_line_parser.rs b/core/datatests/generators/logical_line_parser.rs index cf2d6584..63f75000 100644 --- a/core/datatests/generators/logical_line_parser.rs +++ b/core/datatests/generators/logical_line_parser.rs @@ -3447,7 +3447,12 @@ mod regression { _| Protected = 0; _| Public = 0; _| Published = 0; - " + ", + non_generic_statements = " + _|A := B < C; + _|raise D(E > F); + _|X := Y; + ", ); } } diff --git a/core/src/defaults/parser.rs b/core/src/defaults/parser.rs index 59a52271..32988b8a 100644 --- a/core/src/defaults/parser.rs +++ b/core/src/defaults/parser.rs @@ -1795,6 +1795,10 @@ impl<'a, 'b> InternalDelphiLogicalLineParser<'a, 'b> { } fn finish_logical_line(&mut self) { + self.generic_level = 0; + self.brack_level = 0; + self.paren_level = 0; + if self.is_at_start_of_line() { self.get_current_logical_line_mut().line_type = LLT::Unknown; return;