Skip to main content
Glama
erDiagram.js•34.4 kB
// Generated from er/erDiagram.jison // Do not edit manually module.exports = /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,50],$V1=[1,10],$V2=[1,11],$V3=[1,12],$V4=[1,13],$V5=[1,20],$V6=[1,21],$V7=[1,22],$V8=[1,23],$V9=[1,24],$Va=[1,19],$Vb=[1,25],$Vc=[1,26],$Vd=[1,18],$Ve=[1,33],$Vf=[1,34],$Vg=[1,35],$Vh=[1,36],$Vi=[1,37],$Vj=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,50,63,64,65,66,67],$Vk=[1,42],$Vl=[1,43],$Vm=[1,52],$Vn=[40,50,68,69],$Vo=[1,63],$Vp=[1,61],$Vq=[1,58],$Vr=[1,62],$Vs=[1,64],$Vt=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,63,64,65,66,67],$Vu=[63,64,65,66,67],$Vv=[1,81],$Vw=[1,80],$Vx=[1,78],$Vy=[1,79],$Vz=[6,10,42,47],$VA=[6,10,13,41,42,47,48,49],$VB=[1,89],$VC=[1,88],$VD=[1,87],$VE=[19,56],$VF=[1,98],$VG=[1,97],$VH=[19,56,58,60]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"ER_DIAGRAM":4,"document":5,"EOF":6,"line":7,"SPACE":8,"statement":9,"NEWLINE":10,"entityName":11,"relSpec":12,"COLON":13,"role":14,"STYLE_SEPARATOR":15,"idList":16,"BLOCK_START":17,"attributes":18,"BLOCK_STOP":19,"SQS":20,"SQE":21,"title":22,"title_value":23,"acc_title":24,"acc_title_value":25,"acc_descr":26,"acc_descr_value":27,"acc_descr_multiline_value":28,"direction":29,"classDefStatement":30,"classStatement":31,"styleStatement":32,"direction_tb":33,"direction_bt":34,"direction_rl":35,"direction_lr":36,"CLASSDEF":37,"stylesOpt":38,"separator":39,"UNICODE_TEXT":40,"STYLE_TEXT":41,"COMMA":42,"CLASS":43,"STYLE":44,"style":45,"styleComponent":46,"SEMI":47,"NUM":48,"BRKT":49,"ENTITY_NAME":50,"attribute":51,"attributeType":52,"attributeName":53,"attributeKeyTypeList":54,"attributeComment":55,"ATTRIBUTE_WORD":56,"attributeKeyType":57,",":58,"ATTRIBUTE_KEY":59,"COMMENT":60,"cardinality":61,"relType":62,"ZERO_OR_ONE":63,"ZERO_OR_MORE":64,"ONE_OR_MORE":65,"ONLY_ONE":66,"MD_PARENT":67,"NON_IDENTIFYING":68,"IDENTIFYING":69,"WORD":70,"$accept":0,"$end":1}, terminals_: {2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",56:"ATTRIBUTE_WORD",58:",",59:"ATTRIBUTE_KEY",60:"COMMENT",63:"ZERO_OR_ONE",64:"ZERO_OR_MORE",65:"ONE_OR_MORE",66:"ONLY_ONE",67:"MD_PARENT",68:"NON_IDENTIFYING",69:"IDENTIFYING",70:"WORD"}, productions_: [0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[18,1],[18,2],[51,2],[51,3],[51,3],[51,4],[52,1],[53,1],[54,1],[54,3],[57,1],[55,1],[12,3],[61,1],[61,1],[61,1],[61,1],[61,1],[62,1],[62,1],[14,1],[14,1],[14,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 1: /*console.log('finished parsing');*/ break; case 2: this.$ = [] break; case 3: $$[$0-1].push($$[$0]);this.$ = $$[$0-1] break; case 4: case 5: this.$ = $$[$0] break; case 6: case 7: this.$=[]; break; case 8: yy.addEntity($$[$0-4]); yy.addEntity($$[$0-2]); yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]); break; case 9: yy.addEntity($$[$0-8]); yy.addEntity($$[$0-4]); yy.addRelationship($$[$0-8], $$[$0], $$[$0-4], $$[$0-5]); yy.setClass([$$[$0-8]], $$[$0-6]); yy.setClass([$$[$0-4]], $$[$0-2]); break; case 10: yy.addEntity($$[$0-6]); yy.addEntity($$[$0-2]); yy.addRelationship($$[$0-6], $$[$0], $$[$0-2], $$[$0-3]); yy.setClass([$$[$0-6]], $$[$0-4]); break; case 11: yy.addEntity($$[$0-6]); yy.addEntity($$[$0-4]); yy.addRelationship($$[$0-6], $$[$0], $$[$0-4], $$[$0-5]); yy.setClass([$$[$0-4]], $$[$0-2]); break; case 12: yy.addEntity($$[$0-3]); yy.addAttributes($$[$0-3], $$[$0-1]); break; case 13: yy.addEntity($$[$0-5]); yy.addAttributes($$[$0-5], $$[$0-1]); yy.setClass([$$[$0-5]], $$[$0-3]); break; case 14: yy.addEntity($$[$0-2]); break; case 15: yy.addEntity($$[$0-4]); yy.setClass([$$[$0-4]], $$[$0-2]); break; case 16: yy.addEntity($$[$0]); break; case 17: yy.addEntity($$[$0-2]); yy.setClass([$$[$0-2]], $$[$0]); break; case 18: yy.addEntity($$[$0-6], $$[$0-4]); yy.addAttributes($$[$0-6], $$[$0-1]); break; case 19: yy.addEntity($$[$0-8], $$[$0-6]); yy.addAttributes($$[$0-8], $$[$0-1]); yy.setClass([$$[$0-8]], $$[$0-3]); break; case 20: yy.addEntity($$[$0-5], $$[$0-3]); break; case 21: yy.addEntity($$[$0-7], $$[$0-5]); yy.setClass([$$[$0-7]], $$[$0-2]); break; case 22: yy.addEntity($$[$0-3], $$[$0-1]); break; case 23: yy.addEntity($$[$0-5], $$[$0-3]); yy.setClass([$$[$0-5]], $$[$0]); break; case 24: case 25: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 26: case 27: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 32: yy.setDirection('TB'); break; case 33: yy.setDirection('BT'); break; case 34: yy.setDirection('RL'); break; case 35: yy.setDirection('LR'); break; case 36: this.$ = $$[$0-3];yy.addClass($$[$0-2],$$[$0-1]); break; case 37: case 38: case 56: case 64: this.$ = [$$[$0]]; break; case 39: case 40: this.$ = $$[$0-2].concat([$$[$0]]); break; case 41: this.$ = $$[$0-2];yy.setClass($$[$0-1], $$[$0]); break; case 42: ;this.$ = $$[$0-3];yy.addCssStyles($$[$0-2],$$[$0-1]); break; case 43: this.$ = [$$[$0]] break; case 44: $$[$0-2].push($$[$0]);this.$ = $$[$0-2]; break; case 46: this.$ = $$[$0-1] + $$[$0]; break; case 54: case 76: case 77: this.$ = $$[$0].replace(/"/g, ''); break; case 55: case 78: this.$ = $$[$0]; break; case 57: $$[$0].push($$[$0-1]); this.$=$$[$0]; break; case 58: this.$ = { type: $$[$0-1], name: $$[$0] }; break; case 59: this.$ = { type: $$[$0-2], name: $$[$0-1], keys: $$[$0] }; break; case 60: this.$ = { type: $$[$0-2], name: $$[$0-1], comment: $$[$0] }; break; case 61: this.$ = { type: $$[$0-3], name: $$[$0-2], keys: $$[$0-1], comment: $$[$0] }; break; case 62: case 63: case 66: this.$=$$[$0]; break; case 65: $$[$0-2].push($$[$0]); this.$ = $$[$0-2]; break; case 67: this.$=$$[$0].replace(/"/g, ''); break; case 68: this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] }; /*console.log('relSpec: ' + $$[$0] + $$[$0-1] + $$[$0-2]);*/ break; case 69: this.$ = yy.Cardinality.ZERO_OR_ONE; break; case 70: this.$ = yy.Cardinality.ZERO_OR_MORE; break; case 71: this.$ = yy.Cardinality.ONE_OR_MORE; break; case 72: this.$ = yy.Cardinality.ONLY_ONE; break; case 73: this.$ = yy.Cardinality.MD_PARENT; break; case 74: this.$ = yy.Identification.NON_IDENTIFYING; break; case 75: this.$ = yy.Identification.IDENTIFYING; break; } }, table: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:$V1,24:$V2,26:$V3,28:$V4,29:14,30:15,31:16,32:17,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,40:$Va,43:$Vb,44:$Vc,50:$Vd},o($V0,[2,7],{1:[2,1]}),o($V0,[2,3]),{9:27,11:9,22:$V1,24:$V2,26:$V3,28:$V4,29:14,30:15,31:16,32:17,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,40:$Va,43:$Vb,44:$Vc,50:$Vd},o($V0,[2,5]),o($V0,[2,6]),o($V0,[2,16],{12:28,61:32,15:[1,29],17:[1,30],20:[1,31],63:$Ve,64:$Vf,65:$Vg,66:$Vh,67:$Vi}),{23:[1,38]},{25:[1,39]},{27:[1,40]},o($V0,[2,27]),o($V0,[2,28]),o($V0,[2,29]),o($V0,[2,30]),o($V0,[2,31]),o($Vj,[2,54]),o($Vj,[2,55]),o($V0,[2,32]),o($V0,[2,33]),o($V0,[2,34]),o($V0,[2,35]),{16:41,40:$Vk,41:$Vl},{16:44,40:$Vk,41:$Vl},{16:45,40:$Vk,41:$Vl},o($V0,[2,4]),{11:46,40:$Va,50:$Vd},{16:47,40:$Vk,41:$Vl},{18:48,19:[1,49],51:50,52:51,56:$Vm},{11:53,40:$Va,50:$Vd},{62:54,68:[1,55],69:[1,56]},o($Vn,[2,69]),o($Vn,[2,70]),o($Vn,[2,71]),o($Vn,[2,72]),o($Vn,[2,73]),o($V0,[2,24]),o($V0,[2,25]),o($V0,[2,26]),{13:$Vo,38:57,41:$Vp,42:$Vq,45:59,46:60,48:$Vr,49:$Vs},o($Vt,[2,37]),o($Vt,[2,38]),{16:65,40:$Vk,41:$Vl,42:$Vq},{13:$Vo,38:66,41:$Vp,42:$Vq,45:59,46:60,48:$Vr,49:$Vs},{13:[1,67],15:[1,68]},o($V0,[2,17],{61:32,12:69,17:[1,70],42:$Vq,63:$Ve,64:$Vf,65:$Vg,66:$Vh,67:$Vi}),{19:[1,71]},o($V0,[2,14]),{18:72,19:[2,56],51:50,52:51,56:$Vm},{53:73,56:[1,74]},{56:[2,62]},{21:[1,75]},{61:76,63:$Ve,64:$Vf,65:$Vg,66:$Vh,67:$Vi},o($Vu,[2,74]),o($Vu,[2,75]),{6:$Vv,10:$Vw,39:77,42:$Vx,47:$Vy},{40:[1,82],41:[1,83]},o($Vz,[2,43],{46:84,13:$Vo,41:$Vp,48:$Vr,49:$Vs}),o($VA,[2,45]),o($VA,[2,50]),o($VA,[2,51]),o($VA,[2,52]),o($VA,[2,53]),o($V0,[2,41],{42:$Vq}),{6:$Vv,10:$Vw,39:85,42:$Vx,47:$Vy},{14:86,40:$VB,50:$VC,70:$VD},{16:90,40:$Vk,41:$Vl},{11:91,40:$Va,50:$Vd},{18:92,19:[1,93],51:50,52:51,56:$Vm},o($V0,[2,12]),{19:[2,57]},o($VE,[2,58],{54:94,55:95,57:96,59:$VF,60:$VG}),o([19,56,59,60],[2,63]),o($V0,[2,22],{15:[1,100],17:[1,99]}),o([40,50],[2,68]),o($V0,[2,36]),{13:$Vo,41:$Vp,45:101,46:60,48:$Vr,49:$Vs},o($V0,[2,47]),o($V0,[2,48]),o($V0,[2,49]),o($Vt,[2,39]),o($Vt,[2,40]),o($VA,[2,46]),o($V0,[2,42]),o($V0,[2,8]),o($V0,[2,76]),o($V0,[2,77]),o($V0,[2,78]),{13:[1,102],42:$Vq},{13:[1,104],15:[1,103]},{19:[1,105]},o($V0,[2,15]),o($VE,[2,59],{55:106,58:[1,107],60:$VG}),o($VE,[2,60]),o($VH,[2,64]),o($VE,[2,67]),o($VH,[2,66]),{18:108,19:[1,109],51:50,52:51,56:$Vm},{16:110,40:$Vk,41:$Vl},o($Vz,[2,44],{46:84,13:$Vo,41:$Vp,48:$Vr,49:$Vs}),{14:111,40:$VB,50:$VC,70:$VD},{16:112,40:$Vk,41:$Vl},{14:113,40:$VB,50:$VC,70:$VD},o($V0,[2,13]),o($VE,[2,61]),{57:114,59:$VF},{19:[1,115]},o($V0,[2,20]),o($V0,[2,23],{17:[1,116],42:$Vq}),o($V0,[2,11]),{13:[1,117],42:$Vq},o($V0,[2,10]),o($VH,[2,65]),o($V0,[2,18]),{18:118,19:[1,119],51:50,52:51,56:$Vm},{14:120,40:$VB,50:$VC,70:$VD},{19:[1,121]},o($V0,[2,21]),o($V0,[2,9]),o($V0,[2,19])], defaultActions: {52:[2,62],72:[2,57]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } _token_stack: var lex = function () { var token; token = lexer.lex() || EOF; if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; }; var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages 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, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin("acc_title");return 24; break; case 1: this.popState(); return "acc_title_value"; break; case 2: this.begin("acc_descr");return 26; break; case 3: this.popState(); return "acc_descr_value"; break; case 4: this.begin("acc_descr_multiline"); break; case 5: this.popState(); break; case 6:return "acc_descr_multiline_value"; break; case 7:return 33; break; case 8:return 34; break; case 9:return 35; break; case 10:return 36; break; case 11:return 10; break; case 12:/* skip whitespace */ break; case 13:return 8; break; case 14:return 50; break; case 15:return 70; break; case 16:return 4; break; case 17: this.begin("block"); return 17; break; case 18:return 49; break; case 19:return 49; break; case 20:return 42; break; case 21:return 15; break; case 22:return 13; break; case 23:/* skip whitespace in block */ break; case 24:return 59 break; case 25:return 56; break; case 26:return 56; break; case 27:return 60; break; case 28:/* nothing */ break; case 29: this.popState(); return 19; break; case 30:return yy_.yytext[0]; break; case 31:return 20; break; case 32:return 21; break; case 33: this.begin("style"); return 44; break; case 34: this.popState(); return 10; break; case 35:/* skip whitespace in block */ break; case 36:return 13; break; case 37:return 42; break; case 38:return 49; break; case 39: this.begin("style"); return 37; break; case 40:return 43; break; case 41:return 63; break; case 42:return 65; break; case 43:return 65; break; case 44:return 65; break; case 45:return 63; break; case 46:return 63; break; case 47:return 64; break; case 48:return 64; break; case 49:return 64; break; case 50:return 64; break; case 51:return 64; break; case 52:return 65; break; case 53:return 64; break; case 54:return 65; break; case 55:return 66; break; case 56:return 66; break; case 57:return 66; break; case 58:return 66; break; case 59:return 63; break; case 60:return 64; break; case 61:return 65; break; case 62:return 67; break; case 63:return 68; break; case 64:return 69; break; case 65:return 69; break; case 66:return 68; break; case 67:return 68; break; case 68:return 68; break; case 69:return 41; break; case 70:return 47; break; case 71:return 40; break; case 72:return 48; break; case 73:return yy_.yytext[0]; break; case 74:return 6; break; } }, rules: [/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:1\b)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\s*u\b)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:[0-9])/i,/^(?:.)/i,/^(?:$)/i], conditions: {"style":{"rules":[34,35,36,37,38,69,70],"inclusive":false},"acc_descr_multiline":{"rules":[5,6],"inclusive":false},"acc_descr":{"rules":[3],"inclusive":false},"acc_title":{"rules":[1],"inclusive":false},"block":{"rules":[23,24,25,26,27,28,29,30],"inclusive":false},"INITIAL":{"rules":[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,32,33,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,71,72,73,74],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); return exports.parser.parse(source); }; if (typeof module !== 'undefined' && require.main === module) { exports.main(process.argv.slice(1)); } };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ai-of-mine/fast-mermaid-validator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server