function generateParser (){
/* Jison generated parser */
var parser = (function(){var x = 20;
var parser = {trace: function trace () { },
yy: {},
symbols_: {"error":2,"___#START#___":3,"Zeichnung":4,"EOF":5,"Song":6,"Note":7,"Ton":8,"Strich":9,"Länge":10,"T":11,"Oktave":12,"C":13,"D":14,"E":15,"F":16,"G":17,"A":18,"H":19,"T0":20,"T1":21,"T2":22,"T4":23,"T8":24,"T16":25,"T32":26,"$accept":0,"$end":1},
terminals_: {"2":"error","5":"EOF","9":"Strich","13":"C","14":"D","15":"E","16":"F","17":"G","18":"A","19":"H","20":"T0","21":"T1","22":"T2","23":"T4","24":"T8","25":"T16","26":"T32"},
productions_: [0,[3,2],[4,1],[6,2],[6,0],[7,3],[8,2],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[12,1],[12,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1]],
performAction: function anonymous(yytext,yyleng,yylineno,yy
) {
if(!this.$) this.$ = "";
var $$ = arguments[5],$0=arguments[5].length;
switch(arguments[4]) {
case 1:return $$[$0-2+1-1];
break;
case 2:this.$ = '';
return this.$;
break;
case 3:this.$ = $$[$0-2+1-1] + $$[$0-2+2-1]; // test
break;
case 4:this.$ = '';
break;
case 5:var cy = 0;
if ($$[$0-3+1-1] == 'C0') cy = 80; if ($$[$0-3+1-1] == 'C1') cy = 45;
if ($$[$0-3+1-1] == 'D0') cy = 75; if ($$[$0-3+1-1] == 'D1') cy = 40;
if ($$[$0-3+1-1] == 'E0') cy = 70; if ($$[$0-3+1-1] == 'E1') cy = 35;
if ($$[$0-3+1-1] == 'F0') cy = 65; if ($$[$0-3+1-1] == 'F1') cy = 30;
if ($$[$0-3+1-1] == 'G0') cy = 60; if ($$[$0-3+1-1] == 'G1') cy = 25;
if ($$[$0-3+1-1] == 'A0') cy = 55; if ($$[$0-3+1-1] == 'A1') cy = 20;
if ($$[$0-3+1-1] == 'H0') cy = 50; if ($$[$0-3+1-1] == 'H1') cy = 15;
this.$ = '';
if ($$[$0-3+3-1] == '2' || $$[$0-3+3-1] == '4' || $$[$0-3+3-1] == '8')
this.$ = this.$ + '';
if ($$[$0-3+3-1] == '1' || $$[$0-3+3-1] == '2')
this.$ = this.$ + '';
if ($$[$0-3+3-1] == '8')
this.$ = this.$ + '';
x = x + 40;
break;
case 6:this.$ = $$[$0-2+1-1] + $$[$0-2+2-1];
break;
case 7:this.$ = $$[$0-1+1-1];
break;
case 8:this.$ = $$[$0-1+1-1];
break;
case 9:this.$ = $$[$0-1+1-1];
break;
case 10:this.$ = $$[$0-1+1-1];
break;
case 11:this.$ = $$[$0-1+1-1];
break;
case 12:this.$ = $$[$0-1+1-1];
break;
case 13:this.$ = $$[$0-1+1-1];
break;
case 14:this.$ = $$[$0-1+1-1];
break;
case 15:this.$ = $$[$0-1+1-1];
break;
case 16:this.$ = $$[$0-1+1-1];
break;
case 17:this.$ = $$[$0-1+1-1];
break;
case 18:this.$ = $$[$0-1+1-1];
break;
case 19:this.$ = $$[$0-1+1-1];
break;
case 20:this.$ = $$[$0-1+1-1];
break;
case 21:this.$ = $$[$0-1+1-1];
break;
}
},
table: [{"3":1,"4":2,"5":[2,4],"6":3,"7":4,"8":5,"11":6,"13":[1,7],"14":[1,8],"15":[1,9],"16":[1,10],"17":[1,11],"18":[1,12],"19":[1,13]},{"1":[3]},{"5":[1,14]},{"5":[2,2]},{"5":[2,4],"6":15,"7":4,"8":5,"11":6,"13":[1,7],"14":[1,8],"15":[1,9],"16":[1,10],"17":[1,11],"18":[1,12],"19":[1,13]},{"9":[1,16]},{"12":17,"20":[1,18],"21":[1,19]},{"20":[2,7],"21":[2,7]},{"20":[2,8],"21":[2,8]},{"20":[2,9],"21":[2,9]},{"20":[2,10],"21":[2,10]},{"20":[2,11],"21":[2,11]},{"20":[2,12],"21":[2,12]},{"20":[2,13],"21":[2,13]},{"1":[2,1]},{"5":[2,3]},{"10":20,"21":[1,21],"22":[1,22],"23":[1,23],"24":[1,24],"25":[1,25],"26":[1,26]},{"9":[2,6]},{"9":[2,14]},{"9":[2,15]},{"5":[2,5],"13":[2,5],"14":[2,5],"15":[2,5],"16":[2,5],"17":[2,5],"18":[2,5],"19":[2,5]},{"5":[2,16],"13":[2,16],"14":[2,16],"15":[2,16],"16":[2,16],"17":[2,16],"18":[2,16],"19":[2,16]},{"5":[2,17],"13":[2,17],"14":[2,17],"15":[2,17],"16":[2,17],"17":[2,17],"18":[2,17],"19":[2,17]},{"5":[2,18],"13":[2,18],"14":[2,18],"15":[2,18],"16":[2,18],"17":[2,18],"18":[2,18],"19":[2,18]},{"5":[2,19],"13":[2,19],"14":[2,19],"15":[2,19],"16":[2,19],"17":[2,19],"18":[2,19],"19":[2,19]},{"5":[2,20],"13":[2,20],"14":[2,20],"15":[2,20],"16":[2,20],"17":[2,20],"18":[2,20],"19":[2,20]},{"5":[2,21],"13":[2,21],"14":[2,21],"15":[2,21],"16":[2,21],"17":[2,21],"18":[2,21],"19":[2,21]}],
parseError: function parseError (str, hash) {
throw new Error(str);
},
parse: function parse (input) {
var self = this,
stack = [0],
vstack = [null], // semantic value stack
table = this.table,
yytext = '',
yylineno = 0,
yyleng = 0,
shifts = 0,
reductions = 0,
recovering = 0,
TERROR = 2,
EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
var parseError = this.yy.parseError = typeof this.yy.parseError == 'function' ? this.yy.parseError : this.parseError;
function popStack (n) {
stack.length = stack.length - 2*n;
vstack.length = vstack.length - n;
}
function checkRecover (st) {
for (var p in table[st]) if (p == TERROR) {
//print('RECOVER!!');
return true;
}
return false;
}
function lex() {
var token;
token = self.lexer.lex() || 1; // $end = 1
// if token isn't its numeric value, convert
if (typeof token !== 'number') {
token = self.symbols_[token];
}
return token;
};
var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected, recovered = false;
symbol = lex();
while (true) {
// set first input
state = stack[stack.length-1];
// read action for current state and first input
action = table[state] && table[state][symbol];
// handle parse error
if (typeof action === 'undefined' || !action.length || !action[0]) {
if (!recovering) {
// Report error
expected = [];
for (p in table[state]) if (this.terminals_[p] && p > 2) {
expected.push("'"+this.terminals_[p]+"'");
}
if (this.lexer.showPosition) {
parseError.call(this, 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '),
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
} else {
parseError.call(this, 'Parse error on line '+(yylineno+1)+": Unexpected '"+this.terminals_[symbol]+"'",
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
}
}
// just recovered from another error
if (recovering == 3) {
if (symbol == EOF) {
throw 'Parsing halted.'
}
// discard current lookahead and grab another
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
symbol = lex();
}
// try to recover from error
while (1) {
// check for error recovery rule in this state
if (checkRecover(state)) {
break;
}
if (state == 0) {
throw 'Parsing halted.'
}
popStack(1);
state = stack[stack.length-1];
}
preErrorSymbol = symbol; // save the lookahead token
symbol = TERROR; // insert generic error symbol as new lookahead
state = stack[stack.length-1];
action = table[state] && table[state][TERROR];
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
}
// this shouldn't happen, unless resolve defaults are off
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
}
a = action;
switch (a[0]) {
case 1: // shift
shifts++;
stack.push(symbol);
vstack.push(this.lexer.yytext); // semantic values or junk only, no terminals
stack.push(a[1]); // push state
if (!preErrorSymbol) { // normal execution/no error
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
symbol = lex();
if (recovering > 0)
recovering--;
} else { // error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2: // reduce
reductions++;
len = this.productions_[a[1]][1];
// perform semantic action
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, a[1], vstack);
if (typeof r !== 'undefined') {
return r;
}
// pop off stack
if (len) {
stack = stack.slice(0,-1*len*2);
vstack = vstack.slice(0, -1*len);
}
stack.push(this.productions_[a[1]][0]); // push nonterminal (reduce)
vstack.push(yyval.$);
// goto new state = table[STATE][NONTERMINAL]
newState = table[stack[stack.length-2]][stack[stack.length-1]];
stack.push(newState);
break;
case 3: // accept
this.reductionCount = reductions;
this.shiftCount = shifts;
return true;
}
}
return true;
}};/* Jison generated lexer */
var lexer = (function(){var lexer = ({EOF:"",
parseError:function parseError(str, hash) {
if (this.yy.parseError) {
this.yy.parseError(str, hash);
} else {
throw new Error(str);
}
},
setInput:function (input) {
this._input = input;
this._more = this._less = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
return this;
},
input:function () {
var ch = this._input[0];
this.yytext+=ch;
this.yyleng++;
this.match+=ch;
this.matched+=ch;
var lines = ch.match(/\n/);
if (lines) this.yylineno++;
this._input = this._input.slice(1);
return ch;
},
unput:function (ch) {
this._input = ch + this._input;
return this;
},
more:function () {
this._more = true;
return this;
},
pastInput:function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
upcomingInput:function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20-next.length);
}
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
},
showPosition:function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c+"^";
},
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) this.done = true;
var token,
match,
lines;
if (!this._more) {
this.yytext = '';
this.match = '';
}
for (var i=0;i < this.rules.length; i++) {
match = this._input.match(this.rules[i]);
if (match && (match[0] != "" || i == this.rules.length - 1)) { // change MH
lines = match[0].match(/\n/g);
if (lines) this.yylineno += lines.length;
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
this._more = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, i);
if (token) return token;
else return;
}
}
if (this._input == this.EOF) {
return this.EOF;
} else {
this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
{text: "", token: null, line: this.yylineno});
}
},
lex:function () {
var r = this.next();
if (typeof r !== 'undefined') {
return r;
} else {
return this.lex();
}
}});
lexer.performAction = function anonymous(yy,yy_
) {
switch(arguments[2]) {
case 0:return 9;
break;
case 1:return 22;
break;
case 2:return 23;
break;
case 3:return 24;
break;
case 4:return 25;
break;
case 5:return 26;
break;
case 6:return 21;
break;
case 7:return 20;
break;
case 8:return 13;
break;
case 9:return 14;
break;
case 10:return 15;
break;
case 11:return 16;
break;
case 12:return 17;
break;
case 13:return 18;
break;
case 14:return 19;
break;
case 15:
break;
case 16:return 5;
break;
}
};
lexer.rules = [/^((\-))/,/^((2))/,/^((4))/,/^((8))/,/^((16))/,/^((32))/,/^((1))/,/^((0))/,/^((C))/,/^((D))/,/^((E))/,/^((F))/,/^((G))/,/^((A))/,/^((H|B))/,/^((\s))/,/^($)/];return lexer;})()
parser.lexer = lexer;
return parser;
})(); return parser; }