From e4797d08e16f416a9fd3a061bb29650bfb71dd16 Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Thu, 27 Oct 2022 21:09:46 +0200 Subject: [PATCH] changed chord invocation arguments --- CHANGELOG.md | 1 + musique/value/chord.cc | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2378f10..ab59ac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Block can be called with more parameters then it requires - Removed `[]` sequence notation in favour of `()` - reorganized fold argument order +- Moved from `( )` invocation to `( )` ### Fixed diff --git a/musique/value/chord.cc b/musique/value/chord.cc index e7ba14c..113d31d 100644 --- a/musique/value/chord.cc +++ b/musique/value/chord.cc @@ -30,23 +30,21 @@ Result Chord::operator()(Interpreter& interpreter, std::vector arg std::vector current = { *this }; enum State { - Waiting_For_Octave, Waiting_For_Length, Waiting_For_Note - } state = Waiting_For_Octave; + } state = Waiting_For_Length; static constexpr auto guard = Guard<1> { .name = "note creation", .possibilities = { - "(note:music [octave:number [duration:number]])+" + "(note:music [duration:number])+" } }; auto const next = [&state] { switch (state) { break; case Waiting_For_Length: state = Waiting_For_Note; - break; case Waiting_For_Note: state = Waiting_For_Octave; - break; case Waiting_For_Octave: state = Waiting_For_Length; + break; case Waiting_For_Note: state = Waiting_For_Length; } }; @@ -58,10 +56,6 @@ Result Chord::operator()(Interpreter& interpreter, std::vector arg }; switch (state) { - break; case Waiting_For_Octave: - resolve(&Note::octave, number.floor().as_int()); - return {}; - break; case Waiting_For_Length: resolve(&Note::length, number); return {}; @@ -73,7 +67,7 @@ Result Chord::operator()(Interpreter& interpreter, std::vector arg for (auto &arg : args) { if (auto collection = get_if(arg)) { - if (state != Waiting_For_Length && state != Waiting_For_Octave) { + if (state != Waiting_For_Length) { return guard.yield_error(); } @@ -106,7 +100,7 @@ Result Chord::operator()(Interpreter& interpreter, std::vector arg [](Chord &c) { return std::move(c); }); current.clear(); current.push_back(std::move(*chord)); - state = Waiting_For_Octave; + state = Waiting_For_Length; } }