computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 9b8700bb7550815fafc91859d160774af5bd367d
parent bcfe68d8568b7dd260bab3189d3f8ea23b54c69d
Author: Adam Malone <1319733+freddyz@users.noreply.github.com>
Date:   Tue, 20 Aug 2019 16:43:32 -0500

add placeholders for formula parsing

Diffstat:
Msrc/dtpulse.cpp | 20++++++++++++++++++--
Msrc/dtpulse.hpp | 2++
2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -665,6 +665,11 @@ void Parser::setForLaundry() { tokenStack = {}; setForExactIntegers(tokens[0]); + if(!inError) { + currentIndex = 0; + tokens=tokenStack; + tokenStack={}; + setFormula(peekToken(),true); if (!inError) { currentIndex = 0; tokens = tokenStack; @@ -695,7 +700,7 @@ void Parser::setForLaundry() { } } } - + } } } } @@ -824,6 +829,16 @@ void Parser::setForExactIntegers(Token t) { t = skipAndPeekToken(); } } +void Parser::setFormula(Token t,bool laundryMode) { + while (t.type != "NULL") { + ParseFormula(t,laundryMode); + if (peekToken().type != "NULL") { + tokenStack.push_back(peekToken()); + } + t = skipAndPeekToken(); + } +} + void Parser::replaceLettersWithNumbers(Token t) { std::string letterVal; int intVal; @@ -834,7 +849,6 @@ void Parser::replaceLettersWithNumbers(Token t) { tokenStack.push_back(Token("Integer", letterVal, -1, intVal)); } else if (t.type == "Digit") { - printf("replaceLettersWithNumbers parsing digit\n"); tokenStack.push_back(Token("Digit", t.value, -1, t.value == "0" ? 1 : std::stoi(t.value))); } else { @@ -875,6 +889,8 @@ void Parser::ParseVariable(Token t) { tokenStack.push_back(Token("ChannelVariable", "1", -1, std::stoi("5"))); } } +void Parser::ParseFormula(Token t, bool laundryMode) { +} void Parser::ParseExactInteger(Token t) { if (t.type == "LeftAngle") { t = skipAndPeekToken(); diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp @@ -48,6 +48,7 @@ class Parser { void skipToken(); void setExactValue(Token t); void setForExactIntegers(Token t); + void setFormula(Token t, bool laundryMode); void setForVariables(Token t); void setForChanceOfIntegers(Token t); void setForRandoms(Token t); @@ -67,6 +68,7 @@ class Parser { int currentIndex; void ParseExactValue(Token t); void ParseExactInteger(Token t); + void ParseFormula(Token t, bool laundryMode); void ParseVariable(Token t); void ParseRandomSequence(Token t); void ParseInterleave(Token t,std::vector<std::string> whitelist);