--- linuxsampler/trunk/src/scriptvm/tree.cpp 2014/06/09 19:20:37 2611 +++ linuxsampler/trunk/src/scriptvm/tree.cpp 2016/04/24 18:16:10 2888 @@ -144,6 +144,13 @@ printf(")\n"); } +bool Args::isPolyphonic() const { + for (int i = 0; i < args.size(); ++i) + if (args[i]->isPolyphonic()) + return true; + return false; +} + EventHandlers::EventHandlers() { //printf("EventHandlers::Constructor 0x%lx\n", (long long)this); } @@ -177,6 +184,13 @@ return const_cast(&*args.at(index)); } +bool EventHandlers::isPolyphonic() const { + for (int i = 0; i < args.size(); ++i) + if (args[i]->isPolyphonic()) + return true; + return false; +} + Assignment::Assignment(VariableRef variable, ExpressionRef value) : variable(variable), value(value) { @@ -194,6 +208,11 @@ return STMT_SUCCESS; } +EventHandler::EventHandler(StatementsRef statements) { + this->statements = statements; + usingPolyphonics = statements->isPolyphonic(); +} + void EventHandler::dump(int level) { printIndents(level); printf("EventHandler {\n"); @@ -217,6 +236,13 @@ return &*args.at(i); } +bool Statements::isPolyphonic() const { + for (int i = 0; i < args.size(); ++i) + if (args[i]->isPolyphonic()) + return true; + return false; +} + void FunctionCall::dump(int level) { printIndents(level); printf("FunctionCall '%s' args={\n", functionName.c_str()); @@ -537,6 +563,12 @@ return NULL; } +bool If::isPolyphonic() const { + if (condition->isPolyphonic() || ifStatements->isPolyphonic()) + return true; + return elseStatements ? elseStatements->isPolyphonic() : false; +} + void SelectCase::dump(int level) { printIndents(level); if (select) @@ -587,6 +619,14 @@ return NULL; } +bool SelectCase::isPolyphonic() const { + if (select->isPolyphonic()) return true; + for (int i = 0; i < branches.size(); ++i) + if (branches[i].statements->isPolyphonic()) + return true; + return false; +} + // void Case::addBranch(IntExprRef condition, StatementsRef statements) { // CaseBranchRef b = new CaseBranchRef; // b->from = condition; @@ -788,20 +828,22 @@ } } -void ParserContext::addErr(int line, const char* txt) { +void ParserContext::addErr(int line, int column, const char* txt) { ParserIssue e; e.type = PARSER_ERROR; e.txt = txt; e.line = line; + e.column = column; vErrors.push_back(e); vIssues.push_back(e); } -void ParserContext::addWrn(int line, const char* txt) { +void ParserContext::addWrn(int line, int column, const char* txt) { ParserIssue w; w.type = PARSER_WARNING; w.txt = txt; w.line = line; + w.column = column; vWarnings.push_back(w); vIssues.push_back(w); }