From 7a6df40be550394b5557cdc5abf61ec1eb07d0b3 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 27 Oct 2019 15:38:27 +0100 Subject: [PATCH] ZoneCodeGenerator: Fix basematcher adding tag to result even when not matched successfully --- src/ZoneCodeGenerator/Parsing/Matching/BaseMatcher.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ZoneCodeGenerator/Parsing/Matching/BaseMatcher.cs b/src/ZoneCodeGenerator/Parsing/Matching/BaseMatcher.cs index c22e2ca6..ea926cb5 100644 --- a/src/ZoneCodeGenerator/Parsing/Matching/BaseMatcher.cs +++ b/src/ZoneCodeGenerator/Parsing/Matching/BaseMatcher.cs @@ -53,9 +53,12 @@ var result = new TokenMatchingResult(success, consumedTokens); - if (name != null && success) - result.AddNamedMatch(name, output); - result.AppendTag(Tag); + if (success) + { + if (name != null) + result.AddNamedMatch(name, output); + result.AppendTag(Tag); + } return result; }