if (nd.id == ParserTreeConstants.JJTSCORE) {
bookOrScoreFound = true;
ASTScore sc = (ASTScore) nd;
sc.root = this;
if (this.childContexts.size() == 0) {
Env env=new Env();
env.currentScore=sc;
this.createVirtualContextIfNeeded(env, ASTContext.TYPE_BOOK, sc);
} else {
ASTBook book = (ASTBook) this.childContexts.get(0);
sc.setParentContext(book);
}
}
}
parsedScore = null;
if (bookOrScoreFound) {
parsedScore = findScore(scoreNr, midi);
} else {
//if nothing found->took first Block and create Score manuell
for (int x = 0; x < jjtGetNumChildren(); x++) {
SimpleNode nd = jjtGetChild(x);
if (nd.id == ParserTreeConstants.JJTBLOCK) {
ASTBlock sc = (ASTBlock) nd;
sc.root = this;
sc.root.createVirtualContextIfNeeded(new Env(), ASTContext.TYPE_SCORE, nd);
parsedScore = (ASTScore) nd.getParentContext();
break;
}
}
}
Env env = new Env();
env.currentContext = this;
for (int x = 0; x < jjtGetNumChildren(); x++) {
SimpleNode nd = jjtGetChild(x);
if (nd.id == ParserTreeConstants.JJTSCORE || nd.id == ParserTreeConstants.JJTBOOK
|| (nd.id == ParserTreeConstants.JJTBLOCK && ((ASTBlock) nd).getParentContext() == parsedScore))