From e83fa679db16302a1f7f2017bd15520ec45e3325 Mon Sep 17 00:00:00 2001 From: "Paul \"Code Grump\" Turner" Date: Mon, 16 Dec 2024 11:01:47 +0000 Subject: [PATCH] Make parser "on error" behaviour virtual (#330) * Make parser "on error" behaviour virtual * Added .NET parser change to changelog --- CHANGELOG.md | 3 +++ dotnet/Gherkin/Parser.cs | 2 +- dotnet/gherkin-csharp.razor | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f549f80c..13d5255d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org). This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com). ## [Unreleased] +### Added +- [.NET] Enabled overriding of parser's error-handling + ### Fixed - [c] slight update to existing CMakeFiles.txt to propagate VERSION. Close #320 ([#328](https://github.com/cucumber/gherkin/pull/328)) diff --git a/dotnet/Gherkin/Parser.cs b/dotnet/Gherkin/Parser.cs index 127f34f31..f4a146c4b 100644 --- a/dotnet/Gherkin/Parser.cs +++ b/dotnet/Gherkin/Parser.cs @@ -131,7 +131,7 @@ public T Parse(ITokenScanner tokenScanner, ITokenMatcher tokenMatcher) return GetResult(context); } - private void AddError(ParserContext context, ParserException error) + protected virtual void AddError(ParserContext context, ParserException error) { if (context.Errors.Any(e => e.Message == error.Message)) return; diff --git a/dotnet/gherkin-csharp.razor b/dotnet/gherkin-csharp.razor index 28da67629..a577f388d 100644 --- a/dotnet/gherkin-csharp.razor +++ b/dotnet/gherkin-csharp.razor @@ -1,4 +1,4 @@ -// ------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // // This code was generated by Berp (http://https://github.com/gasparnagy/berp/). // @@ -122,7 +122,7 @@ namespace @Model.Namespace return GetResult(context); } - private void AddError(ParserContext context, ParserException error) + protected virtual void AddError(ParserContext context, ParserException error) { if (context.Errors.Any(e => e.Message == error.Message)) return;