From 1d3c91d6e175100414d0abfd5b3dbc93eabdf7a7 Mon Sep 17 00:00:00 2001 From: Takeshi Yokemura Date: Sat, 12 Feb 2022 17:01:11 +0900 Subject: [PATCH] Fixed envelope main section empty error --- Source/EnvelopeParserTest.h | 1 - Source/FrameSequenceParseErrors.cpp | 8 ++++---- Source/FrameSequenceParseErrors.h | 2 +- Source/FrameSequenceParser.cpp | 7 ++++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/EnvelopeParserTest.h b/Source/EnvelopeParserTest.h index a601ded..a1d953b 100644 --- a/Source/EnvelopeParserTest.h +++ b/Source/EnvelopeParserTest.h @@ -328,7 +328,6 @@ public: expect(result30.valueAt(1) == 2); expect(result30.loopStartIndex == 0); expect(result30.releaseSequenceStartIndex == 1); - expect(error = kParseWarningPreRepeatSegmentEmpty); beginTest ("Empty segment warning(in-repeat)"); error = kParseErrorNone; diff --git a/Source/FrameSequenceParseErrors.cpp b/Source/FrameSequenceParseErrors.cpp index 3e7cd37..517ed51 100644 --- a/Source/FrameSequenceParseErrors.cpp +++ b/Source/FrameSequenceParseErrors.cpp @@ -14,10 +14,6 @@ String getParseErrorString (ParseError err, int minValue, int maxValue) { switch (err) { - case kParseWarningPreRepeatSegmentEmpty: - return TRANS ("Main body of the sequence is empty"); - break; - case kParseWarningRepeatSegmentEmpty: return TRANS ("Repeat section is empty"); break; @@ -26,6 +22,10 @@ String getParseErrorString (ParseError err, int minValue, int maxValue) return TRANS ("Release section is empty"); break; + case kParseErrorPreReleaseSegmentEmpty: + return TRANS ("Main body of the sequence is empty"); + break; + case kParseErrorDuplicatedReleaseDelimiter: return TRANS ("You cannot use \"|\" more than once"); break; diff --git a/Source/FrameSequenceParseErrors.h b/Source/FrameSequenceParseErrors.h index db6ca3a..e4b4485 100644 --- a/Source/FrameSequenceParseErrors.h +++ b/Source/FrameSequenceParseErrors.h @@ -15,10 +15,10 @@ enum ParseError { kParseErrorNone = 0, kParseErrorLevelWarning, - kParseWarningPreRepeatSegmentEmpty, kParseWarningRepeatSegmentEmpty, kParseWarningReleaseSegmentEmpty, kParseErrorLevelFatal, + kParseErrorPreReleaseSegmentEmpty, kParseErrorDuplicatedReleaseDelimiter, kParseErrorDuplicatedOpenBracket, kParseErrorDuplicatedCloseBracket, diff --git a/Source/FrameSequenceParser.cpp b/Source/FrameSequenceParser.cpp index d1f4350..fb00c34 100644 --- a/Source/FrameSequenceParser.cpp +++ b/Source/FrameSequenceParser.cpp @@ -438,9 +438,6 @@ FrameSequence FrameSequenceParser::parse (const String& input, { return fs; } - if (sequence.size() == 0) { - *error = kParseWarningPreRepeatSegmentEmpty; - } fs.sequence = sequence; fs.sequence.reserve (1000); @@ -470,6 +467,10 @@ FrameSequence FrameSequenceParser::parse (const String& input, // Set repeatEndIndex according to current working frameSequence length fs.releaseSequenceStartIndex = (int)fs.sequence.size(); } + + if (fs.sequence.size() == 0) { + *error = kParseErrorPreReleaseSegmentEmpty; + } if (hasRelease) // If release exists: {