computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 493e1d36540ef774dbc3da84aebd3807ae1dbe48
parent a5522eddad5140cfc01853f3c7fb9fe4f8047f26
Author: Adam Malone <1319733+freddyz@users.noreply.github.com>
Date:   Wed, 26 Dec 2018 16:52:38 -0600

put in integer parsing for future laundry soup better parser

Diffstat:
Msrc/dtpulse.cpp | 31++++++++++++++++++++++---------
Msrc/dtpulse.hpp | 1+
2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -489,21 +489,18 @@ Parser::Parser(std::string expr) { currentIndex=0; setExactValue(tokens[0]); - //printTokenVector(tokenStack); if(!inError) { currentIndex=0; tokens=tokenStack; tokenStack = {}; setForRandoms(peekToken()); if(!inError) { - //printTokenVector(tokenStack); currentIndex = 0; tokens = tokenStack; tokenStack={}; setForInterleave(peekToken()); if(!inError) { - //printTokenVector(tokenStack); currentIndex = 0; tokens = tokenStack; tokenStack = {}; @@ -514,12 +511,12 @@ Parser::Parser(std::string expr) { tokens=tokenStack; tokenStack = {}; setForSquareBrackets(peekToken()); - if(!inError) { - currentIndex = 0; - tokens=tokenStack; - tokenStack = {}; - setFinal(peekToken()); - } + if(!inError) { + currentIndex = 0; + tokens=tokenStack; + tokenStack = {}; + setFinal(peekToken()); + } } } } @@ -587,6 +584,22 @@ void Parser::setForSquareBrackets(Token t) { t = skipAndPeekToken(); } } +void Parser::ParseExactInteger(Token t) { + if(t.type=="LeftAngle") { + t=skipAndPeekToken(); + std::string num=""; + while(t.type=="Digit") { + num+=t.value; + t = skipAndPeekToken(); + } + if(t.type=="RightAngle") { + tokenStack.push_back(Token("Integer",num)); + } + else { + inError=true; + } + } // not a LeftAngle, dont do shit +} void Parser::ParseExactValue(Token t) { if(t.type=="LeftAngle") { diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp @@ -53,6 +53,7 @@ class Parser { private: int currentIndex; void ParseExactValue(Token t); + void ParseExactInteger(Token t); void ParseRandomSequence(Token t); void ParseInterleave(Token t); void ParseAtExpand(Token t);