From bc7a7b2c2401f974f9042e477195f44b24469939 Mon Sep 17 00:00:00 2001 From: obligaron Date: Tue, 14 Jan 2025 22:25:22 +0100 Subject: [PATCH] [Perl] Optimise error handling for unclosed DocStrings --- CHANGELOG.md | 1 + perl/lib/Gherkin/TokenMatcher.pm | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc9fcdfa5..bc87f6949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt - [.NET] Use string-ordinal comparison consistently and remove old Mono workaround - [.NET] Improved startup time - [c] Optimise error handling for empty datatable rows +- [Perl] Optimise error handling for unclosed DocStrings ### Changed - [cpp] add generic support for ABI versioning with VERSION ([#328](https://github.com/cucumber/gherkin/pull/328)) diff --git a/perl/lib/Gherkin/TokenMatcher.pm b/perl/lib/Gherkin/TokenMatcher.pm index f69afa167..696d8686c 100644 --- a/perl/lib/Gherkin/TokenMatcher.pm +++ b/perl/lib/Gherkin/TokenMatcher.pm @@ -238,6 +238,9 @@ sub match_StepLine { sub match_DocStringSeparator { my ( $self, $token ) = @_; + if ($token->is_eof) { + return; + } if ( !$self->_active_doc_string_separator ) { return $self->_match_DocStringSeparator( $token, '"""', 1 ) || $self->_match_DocStringSeparator( $token, '```', 1 );