Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bing integration up to date

  • Loading branch information...
commit 824c2ec5427b0af5d30a69e4ff700534c407e07d 1 parent f4bdfbb
@zaach authored
View
1  .gitignore
@@ -1 +1,2 @@
.DS_Store
+node_modules
View
4 .npmignore
@@ -0,0 +1,4 @@
+src/
+web/
+examples/
+bin/
View
15 README.md
@@ -14,15 +14,11 @@ Briefly, Jison takes a JSON encoded grammar specification and outputs a JavaScri
Installation
------------
-Jison can be installed for [Narwhal](http://github.com/280north/narwhal) using its bundled `tusk` command or for [Node](http://nodejs.org) using [`npm`](http://github.com/isaacs/npm/)
+Jison can be installed for [Node](http://nodejs.org) using [`npm`](http://github.com/isaacs/npm/)
Using npm:
- npm install jison
-
-Using tusk:
-
- tusk install jison
+ npm install jison -g
Usage from the command line
-----------------------
@@ -95,12 +91,7 @@ Run tests with:
Projects using Jison
------------------
-* [CoffeeScript](http://github.com/jashkenas/coffee-script)
-* [handlebars.js](https://github.com/wycats/handlebars.js)
-* [jQuery.sheet](http://visop-dev.com/Project+jQuery.sheet)
-* [cafe](http://github.com/zaach/cafe)
-* [jsonlint](http://github.com/zaach/jsonlint)
-* [Orderly.js](http://github.com/zaach/orderly.js)
+View them on the [wiki](https://github.com/zaach/jison/wiki/ProjectsUsingJison), or add your own.
Contributors
View
28 lib/jison.js
@@ -565,12 +565,16 @@ lrGeneratorMixin.Item = typal.construct({
eq: function (e) {
return e.id === this.id;
},
+ handleToString: function () {
+ var handle = this.production.handle.slice(0);
+ handle[this.dotPosition] = '.'+(handle[this.dotPosition]||'');
+ return handle.join(' ');
+ },
toString: function () {
var temp = this.production.handle.slice(0);
temp[this.dotPosition] = '.'+(temp[this.dotPosition]||'');
- return '['+this.production.symbol+" -> "+temp.join(' ')
- +(this.follows.length === 0 ? "" : ", "+this.follows.join('/'))
- +']';
+ return this.production.symbol+" -> "+temp.join(' ')
+ +(this.follows.length === 0 ? "" : " #lookaheads= "+this.follows.join(' '));
}
});
@@ -711,6 +715,7 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
var states = [],
nonterminals = this.nonterminals,
operators = this.operators,
+ conflictedStates = {}, // array of [state, token] tuples
self = this,
s = 1, // shift
r = 2, // reduce
@@ -766,7 +771,8 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
if (sol.bydefault) {
self.conflicts++;
if (!self.DEBUG) {
- self.warn('Conflict in grammar (state:',k, ', token:',stackSymbol, ")\n ", printAction(sol.r, self), "\n ", printAction(sol.s, self));
+ self.warn('Conflict in grammar: multiple actions possible when lookahead token is ',stackSymbol,' in state ',k, "\n- ", printAction(sol.r, self), "\n- ", printAction(sol.s, self));
+ conflictedStates[k] = true;
}
if (self.options.noDefaultResolve) {
if (!(action[0] instanceof Array))
@@ -789,6 +795,14 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
});
+ if (!self.DEBUG && self.conflicts > 0) {
+ self.warn("\nStates with conflicts:");
+ each(conflictedStates, function (val, state) {
+ self.warn('State '+state);
+ self.warn(' ',itemSets.item(state).join("\n "));
+ });
+ }
+
return states;
};
@@ -930,8 +944,8 @@ function commonjsMain (args) {
// debug mixin for LR parser generators
function printAction (a, gen) {
- var s = a[0] == 1 ? 'shift '+(gen.symbols[a[1]] || a[1]) :
- a[0] == 2 ? 'reduce by '+gen.productions[a[1]] :
+ var s = a[0] == 1 ? 'shift token (then go to state '+a[1]+')' :
+ a[0] == 2 ? 'reduce by rule: '+gen.productions[a[1]] :
'accept' ;
return s;
@@ -946,7 +960,7 @@ var lrGeneratorDebug = {
if (this.conflicts > 0) {
this.resolutions.forEach(function (r, i) {
if (r[2].bydefault) {
- self.warn('Conflict at state:',r[0], ', Token:',r[1], "\n ", printAction(r[2].r, self), "\n ", printAction(r[2].s, self));
+ self.warn('Conflict at state: ',r[0], ', token: ',r[1], "\n ", printAction(r[2].r, self), "\n ", printAction(r[2].s, self));
}
});
this.trace("\n"+this.conflicts+" Conflict(s) found in grammar.");
View
5 lib/jison/cli-wrapper.js
@@ -2,7 +2,7 @@
var JISON = require('../jison'),
IO = require('./util/io'),
- nomnom = require('./util/nomnom');
+ nomnom = require('nomnom');
var opts = [
{ name: 'file',
@@ -47,12 +47,9 @@ exports.main = function (argv) {
}
IO.write(args.outfile||(name+'.js'), processGrammar(raw, lex, name));
} else {
- var read = false;
IO.stdin(function (raw) {
- read = true;
IO.stdout(processGrammar(raw));
});
- setTimeout(function (){if(!read)IO.exit()}, 10);
}
}
View
7 lib/jison/json2jison.js
@@ -126,17 +126,20 @@ function genLex (lex) {
s.push('\n%{\n', lex.actionInclude, '\n%}\n');
}
s.push('\n%%\n');
+
+ var longestRule = lex.rules.reduce(function (prev, curr) { return prev > curr[0].length ? prev : curr[0].length; }, 0);
if ('rules' in lex) {
for (var rule;rule=lex.rules.shift();) {
if (rule.length > 2) s.push('<'+rule.shift().join(',')+'>');
- var reg = genLexRegex(rule[0]);
- s.push(reg, new Array(indent-reg.length+1).join(' '), genLexRule(rule[1]), '\n');
+ var reg = genLexRegex(rule[0]);
+ s.push(reg, new Array(longestRule-reg.length+5).join(' '), genLexRule(rule[1]), '\n');
}
}
s.push('\n');
return s.join('');
}
+
function genLexRegex (regex) {
var matcher = regex.replace(/^([a-zA-Z0-9]+)\\b$/, "\"$1\"")
.replace(/\\([.*+?^${}()|[\]\/\\])/g,"$1")
View
98 lib/jison/util/lex-parser.js
@@ -2,9 +2,9 @@
var jisonlex = (function(){
var parser = {trace: function trace() { },
yy: {},
-symbols_: {"error":2,"lex":3,"definitions":4,"include":5,"%%":6,"rules":7,"epilogue":8,"EOF":9,"action":10,"definition":11,"name":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"NAME":18,"rule":19,"start_conditions":20,"<":21,"name_list":22,">":23,"*":24,",":25,"ACTION":26,"regex_list":27,"|":28,"regex_concat":29,"regex_base":30,"(":31,")":32,"+":33,"?":34,"/":35,"/!":36,"name_expansion":37,"range_regex":38,"any_group_regex":39,".":40,"^":41,"$":42,"string":43,"escape_char":44,"{":45,"}":46,"ANY_GROUP_REGEX":47,"ESCAPE_CHAR":48,"RANGE_REGEX":49,"STRING_LIT":50,"$accept":0,"$end":1},
-terminals_: {2:"error",6:"%%",9:"EOF",14:"START_INC",16:"START_EXC",18:"NAME",21:"<",23:">",24:"*",25:",",26:"ACTION",28:"|",31:"(",32:")",33:"+",34:"?",35:"/",36:"/!",40:".",41:"^",42:"$",45:"{",46:"}",47:"ANY_GROUP_REGEX",48:"ESCAPE_CHAR",49:"RANGE_REGEX",50:"STRING_LIT"},
-productions_: [0,[3,5],[8,1],[8,2],[5,1],[5,0],[4,2],[4,0],[11,2],[11,2],[11,2],[15,1],[15,2],[17,1],[17,2],[12,1],[7,2],[7,1],[19,3],[20,3],[20,3],[20,0],[22,1],[22,3],[10,1],[13,1],[27,3],[27,1],[29,2],[29,1],[30,3],[30,2],[30,2],[30,2],[30,2],[30,2],[30,1],[30,2],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[37,3],[39,1],[44,1],[38,1],[43,1]],
+symbols_: {"error":2,"lex":3,"definitions":4,"include":5,"%%":6,"rules":7,"epilogue":8,"EOF":9,"action":10,"definition":11,"name":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"NAME":18,"rule":19,"start_conditions":20,"<":21,"name_list":22,">":23,"*":24,",":25,"ACTION":26,"regex_list":27,"|":28,"regex_concat":29,"regex_base":30,"(":31,")":32,"SPECIAL_GROUP":33,"+":34,"?":35,"/":36,"/!":37,"name_expansion":38,"range_regex":39,"any_group_regex":40,".":41,"^":42,"$":43,"string":44,"escape_char":45,"{":46,"}":47,"ANY_GROUP_REGEX":48,"ESCAPE_CHAR":49,"RANGE_REGEX":50,"STRING_LIT":51,"$accept":0,"$end":1},
+terminals_: {2:"error",6:"%%",9:"EOF",14:"START_INC",16:"START_EXC",18:"NAME",21:"<",23:">",24:"*",25:",",26:"ACTION",28:"|",31:"(",32:")",33:"SPECIAL_GROUP",34:"+",35:"?",36:"/",37:"/!",41:".",42:"^",43:"$",46:"{",47:"}",48:"ANY_GROUP_REGEX",49:"ESCAPE_CHAR",50:"RANGE_REGEX",51:"STRING_LIT"},
+productions_: [0,[3,5],[8,1],[8,2],[5,1],[5,0],[4,2],[4,0],[11,2],[11,2],[11,2],[15,1],[15,2],[17,1],[17,2],[12,1],[7,2],[7,1],[19,3],[20,3],[20,3],[20,0],[22,1],[22,3],[10,1],[13,1],[27,3],[27,1],[29,2],[29,1],[30,3],[30,3],[30,2],[30,2],[30,2],[30,2],[30,2],[30,1],[30,2],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[38,3],[40,1],[45,1],[39,1],[44,1]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var $0 = $$.length - 1;
@@ -73,38 +73,40 @@ case 28: this.$ = $$[$0-1]+$$[$0];
break;
case 30: this.$ = '('+$$[$0-1]+')';
break;
-case 31: this.$ = $$[$0-1]+'+';
+case 31: this.$ = $$[$0-2]+$$[$0-1]+')';
break;
-case 32: this.$ = $$[$0-1]+'*';
+case 32: this.$ = $$[$0-1]+'+';
break;
-case 33: this.$ = $$[$0-1]+'?';
+case 33: this.$ = $$[$0-1]+'*';
break;
-case 34: this.$ = '(?='+$$[$0]+')';
+case 34: this.$ = $$[$0-1]+'?';
break;
-case 35: this.$ = '(?!'+$$[$0]+')';
+case 35: this.$ = '(?='+$$[$0]+')';
break;
-case 37: this.$ = $$[$0-1]+$$[$0];
+case 36: this.$ = '(?!'+$$[$0]+')';
break;
-case 39: this.$ = '.';
+case 38: this.$ = $$[$0-1]+$$[$0];
break;
-case 40: this.$ = '^';
+case 40: this.$ = '.';
break;
-case 41: this.$ = '$';
+case 41: this.$ = '^';
break;
-case 44: this.$ = '{'+$$[$0-1]+'}';
+case 42: this.$ = '$';
break;
-case 45: this.$ = yytext;
+case 45: this.$ = '{'+$$[$0-1]+'}';
break;
case 46: this.$ = yytext;
break;
case 47: this.$ = yytext;
break;
-case 48: this.$ = yy.prepareString(yytext.substr(1, yytext.length-2));
+case 48: this.$ = yytext;
+break;
+case 49: this.$ = yy.prepareString(yytext.substr(1, yytext.length-2));
break;
}
},
-table: [{3:1,4:2,6:[2,7],14:[2,7],16:[2,7],18:[2,7],26:[2,7]},{1:[3]},{5:3,6:[2,5],10:5,11:4,12:6,14:[1,7],16:[1,8],18:[1,10],26:[1,9]},{6:[1,11]},{6:[2,6],14:[2,6],16:[2,6],18:[2,6],26:[2,6]},{6:[2,4]},{13:12,27:13,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{15:30,18:[1,31]},{17:32,18:[1,33]},{6:[2,24],9:[2,24],21:[2,24],31:[2,24],35:[2,24],36:[2,24],40:[2,24],41:[2,24],42:[2,24],45:[2,24],47:[2,24],48:[2,24],50:[2,24]},{31:[2,15],35:[2,15],36:[2,15],40:[2,15],41:[2,15],42:[2,15],45:[2,15],46:[2,15],47:[2,15],48:[2,15],50:[2,15]},{7:34,19:35,20:36,21:[1,37],31:[2,21],35:[2,21],36:[2,21],40:[2,21],41:[2,21],42:[2,21],45:[2,21],47:[2,21],48:[2,21],50:[2,21]},{6:[2,8],14:[2,8],16:[2,8],18:[2,8],26:[2,8]},{6:[2,25],14:[2,25],16:[2,25],18:[2,25],26:[2,25],28:[1,38]},{6:[2,27],14:[2,27],16:[2,27],18:[2,27],26:[2,27],28:[2,27],30:39,31:[1,16],32:[2,27],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{6:[2,29],14:[2,29],16:[2,29],18:[2,29],24:[1,41],26:[2,29],28:[2,29],31:[2,29],32:[2,29],33:[1,40],34:[1,42],35:[2,29],36:[2,29],38:43,40:[2,29],41:[2,29],42:[2,29],45:[2,29],47:[2,29],48:[2,29],49:[1,44],50:[2,29]},{27:45,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{30:46,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{30:47,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{6:[2,36],14:[2,36],16:[2,36],18:[2,36],24:[2,36],26:[2,36],28:[2,36],31:[2,36],32:[2,36],33:[2,36],34:[2,36],35:[2,36],36:[2,36],40:[2,36],41:[2,36],42:[2,36],45:[2,36],47:[2,36],48:[2,36],49:[2,36],50:[2,36]},{6:[2,38],14:[2,38],16:[2,38],18:[2,38],24:[2,38],26:[2,38],28:[2,38],31:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],41:[2,38],42:[2,38],45:[2,38],47:[2,38],48:[2,38],49:[2,38],50:[2,38]},{6:[2,39],14:[2,39],16:[2,39],18:[2,39],24:[2,39],26:[2,39],28:[2,39],31:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],41:[2,39],42:[2,39],45:[2,39],47:[2,39],48:[2,39],49:[2,39],50:[2,39]},{6:[2,40],14:[2,40],16:[2,40],18:[2,40],24:[2,40],26:[2,40],28:[2,40],31:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[2,40],42:[2,40],45:[2,40],47:[2,40],48:[2,40],49:[2,40],50:[2,40]},{6:[2,41],14:[2,41],16:[2,41],18:[2,41],24:[2,41],26:[2,41],28:[2,41],31:[2,41],32:[2,41],33:[2,41],34:[2,41],35:[2,41],36:[2,41],40:[2,41],41:[2,41],42:[2,41],45:[2,41],47:[2,41],48:[2,41],49:[2,41],50:[2,41]},{6:[2,42],14:[2,42],16:[2,42],18:[2,42],24:[2,42],26:[2,42],28:[2,42],31:[2,42],32:[2,42],33:[2,42],34:[2,42],35:[2,42],36:[2,42],40:[2,42],41:[2,42],42:[2,42],45:[2,42],47:[2,42],48:[2,42],49:[2,42],50:[2,42]},{6:[2,43],14:[2,43],16:[2,43],18:[2,43],24:[2,43],26:[2,43],28:[2,43],31:[2,43],32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],41:[2,43],42:[2,43],45:[2,43],47:[2,43],48:[2,43],49:[2,43],50:[2,43]},{12:48,18:[1,10]},{6:[2,45],14:[2,45],16:[2,45],18:[2,45],24:[2,45],26:[2,45],28:[2,45],31:[2,45],32:[2,45],33:[2,45],34:[2,45],35:[2,45],36:[2,45],40:[2,45],41:[2,45],42:[2,45],45:[2,45],47:[2,45],48:[2,45],49:[2,45],50:[2,45]},{6:[2,48],14:[2,48],16:[2,48],18:[2,48],24:[2,48],26:[2,48],28:[2,48],31:[2,48],32:[2,48],33:[2,48],34:[2,48],35:[2,48],36:[2,48],40:[2,48],41:[2,48],42:[2,48],45:[2,48],47:[2,48],48:[2,48],49:[2,48],50:[2,48]},{6:[2,46],14:[2,46],16:[2,46],18:[2,46],24:[2,46],26:[2,46],28:[2,46],31:[2,46],32:[2,46],33:[2,46],34:[2,46],35:[2,46],36:[2,46],40:[2,46],41:[2,46],42:[2,46],45:[2,46],47:[2,46],48:[2,46],49:[2,46],50:[2,46]},{6:[2,9],14:[2,9],16:[2,9],18:[1,49],26:[2,9]},{6:[2,11],14:[2,11],16:[2,11],18:[2,11],26:[2,11]},{6:[2,10],14:[2,10],16:[2,10],18:[1,50],26:[2,10]},{6:[2,13],14:[2,13],16:[2,13],18:[2,13],26:[2,13]},{6:[1,54],8:51,9:[1,53],19:52,20:36,21:[1,37],31:[2,21],35:[2,21],36:[2,21],40:[2,21],41:[2,21],42:[2,21],45:[2,21],47:[2,21],48:[2,21],50:[2,21]},{6:[2,17],9:[2,17],21:[2,17],31:[2,17],35:[2,17],36:[2,17],40:[2,17],41:[2,17],42:[2,17],45:[2,17],47:[2,17],48:[2,17],50:[2,17]},{13:55,27:13,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{18:[1,58],22:56,24:[1,57]},{27:59,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{6:[2,28],14:[2,28],16:[2,28],18:[2,28],24:[1,41],26:[2,28],28:[2,28],31:[2,28],32:[2,28],33:[1,40],34:[1,42],35:[2,28],36:[2,28],38:43,40:[2,28],41:[2,28],42:[2,28],45:[2,28],47:[2,28],48:[2,28],49:[1,44],50:[2,28]},{6:[2,31],14:[2,31],16:[2,31],18:[2,31],24:[2,31],26:[2,31],28:[2,31],31:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],41:[2,31],42:[2,31],45:[2,31],47:[2,31],48:[2,31],49:[2,31],50:[2,31]},{6:[2,32],14:[2,32],16:[2,32],18:[2,32],24:[2,32],26:[2,32],28:[2,32],31:[2,32],32:[2,32],33:[2,32],34:[2,32],35:[2,32],36:[2,32],40:[2,32],41:[2,32],42:[2,32],45:[2,32],47:[2,32],48:[2,32],49:[2,32],50:[2,32]},{6:[2,33],14:[2,33],16:[2,33],18:[2,33],24:[2,33],26:[2,33],28:[2,33],31:[2,33],32:[2,33],33:[2,33],34:[2,33],35:[2,33],36:[2,33],40:[2,33],41:[2,33],42:[2,33],45:[2,33],47:[2,33],48:[2,33],49:[2,33],50:[2,33]},{6:[2,37],14:[2,37],16:[2,37],18:[2,37],24:[2,37],26:[2,37],28:[2,37],31:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],41:[2,37],42:[2,37],45:[2,37],47:[2,37],48:[2,37],49:[2,37],50:[2,37]},{6:[2,47],14:[2,47],16:[2,47],18:[2,47],24:[2,47],26:[2,47],28:[2,47],31:[2,47],32:[2,47],33:[2,47],34:[2,47],35:[2,47],36:[2,47],40:[2,47],41:[2,47],42:[2,47],45:[2,47],47:[2,47],48:[2,47],49:[2,47],50:[2,47]},{28:[1,38],32:[1,60]},{6:[2,34],14:[2,34],16:[2,34],18:[2,34],24:[1,41],26:[2,34],28:[2,34],31:[2,34],32:[2,34],33:[1,40],34:[1,42],35:[2,34],36:[2,34],38:43,40:[2,34],41:[2,34],42:[2,34],45:[2,34],47:[2,34],48:[2,34],49:[1,44],50:[2,34]},{6:[2,35],14:[2,35],16:[2,35],18:[2,35],24:[1,41],26:[2,35],28:[2,35],31:[2,35],32:[2,35],33:[1,40],34:[1,42],35:[2,35],36:[2,35],38:43,40:[2,35],41:[2,35],42:[2,35],45:[2,35],47:[2,35],48:[2,35],49:[1,44],50:[2,35]},{46:[1,61]},{6:[2,12],14:[2,12],16:[2,12],18:[2,12],26:[2,12]},{6:[2,14],14:[2,14],16:[2,14],18:[2,14],26:[2,14]},{1:[2,1]},{6:[2,16],9:[2,16],21:[2,16],31:[2,16],35:[2,16],36:[2,16],40:[2,16],41:[2,16],42:[2,16],45:[2,16],47:[2,16],48:[2,16],50:[2,16]},{1:[2,2]},{9:[1,62]},{10:63,26:[1,9]},{23:[1,64],25:[1,65]},{23:[1,66]},{23:[2,22],25:[2,22]},{6:[2,26],14:[2,26],16:[2,26],18:[2,26],26:[2,26],28:[1,38],32:[2,26]},{6:[2,30],14:[2,30],16:[2,30],18:[2,30],24:[2,30],26:[2,30],28:[2,30],31:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],41:[2,30],42:[2,30],45:[2,30],47:[2,30],48:[2,30],49:[2,30],50:[2,30]},{6:[2,44],14:[2,44],16:[2,44],18:[2,44],24:[2,44],26:[2,44],28:[2,44],31:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],41:[2,44],42:[2,44],45:[2,44],47:[2,44],48:[2,44],49:[2,44],50:[2,44]},{1:[2,3]},{6:[2,18],9:[2,18],21:[2,18],31:[2,18],35:[2,18],36:[2,18],40:[2,18],41:[2,18],42:[2,18],45:[2,18],47:[2,18],48:[2,18],50:[2,18]},{31:[2,19],35:[2,19],36:[2,19],40:[2,19],41:[2,19],42:[2,19],45:[2,19],47:[2,19],48:[2,19],50:[2,19]},{18:[1,67]},{31:[2,20],35:[2,20],36:[2,20],40:[2,20],41:[2,20],42:[2,20],45:[2,20],47:[2,20],48:[2,20],50:[2,20]},{23:[2,23],25:[2,23]}],
-defaultActions: {5:[2,4],51:[2,1],53:[2,2],62:[2,3]},
+table: [{3:1,4:2,6:[2,7],14:[2,7],16:[2,7],18:[2,7],26:[2,7]},{1:[3]},{5:3,6:[2,5],10:5,11:4,12:6,14:[1,7],16:[1,8],18:[1,10],26:[1,9]},{6:[1,11]},{6:[2,6],14:[2,6],16:[2,6],18:[2,6],26:[2,6]},{6:[2,4]},{13:12,27:13,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:[2,24],9:[2,24],21:[2,24],31:[2,24],33:[2,24],36:[2,24],37:[2,24],41:[2,24],42:[2,24],43:[2,24],46:[2,24],48:[2,24],49:[2,24],51:[2,24]},{31:[2,15],33:[2,15],36:[2,15],37:[2,15],41:[2,15],42:[2,15],43:[2,15],46:[2,15],47:[2,15],48:[2,15],49:[2,15],51:[2,15]},{7:35,19:36,20:37,21:[1,38],31:[2,21],33:[2,21],36:[2,21],37:[2,21],41:[2,21],42:[2,21],43:[2,21],46:[2,21],48:[2,21],49:[2,21],51:[2,21]},{6:[2,8],14:[2,8],16:[2,8],18:[2,8],26:[2,8]},{6:[2,25],14:[2,25],16:[2,25],18:[2,25],26:[2,25],28:[1,39]},{6:[2,27],14:[2,27],16:[2,27],18:[2,27],26:[2,27],28:[2,27],30:40,31:[1,16],32:[2,27],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{6:[2,29],14:[2,29],16:[2,29],18:[2,29],24:[1,42],26:[2,29],28:[2,29],31:[2,29],32:[2,29],33:[2,29],34:[1,41],35:[1,43],36:[2,29],37:[2,29],39:44,41:[2,29],42:[2,29],43:[2,29],46:[2,29],48:[2,29],49:[2,29],50:[1,45],51:[2,29]},{27:46,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{27:47,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{30:48,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{30:49,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{6:[2,37],14:[2,37],16:[2,37],18:[2,37],24:[2,37],26:[2,37],28:[2,37],31:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],37:[2,37],41:[2,37],42:[2,37],43:[2,37],46:[2,37],48:[2,37],49:[2,37],50:[2,37],51:[2,37]},{6:[2,39],14:[2,39],16:[2,39],18:[2,39],24:[2,39],26:[2,39],28:[2,39],31:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],37:[2,39],41:[2,39],42:[2,39],43:[2,39],46:[2,39],48:[2,39],49:[2,39],50:[2,39],51:[2,39]},{6:[2,40],14:[2,40],16:[2,40],18:[2,40],24:[2,40],26:[2,40],28:[2,40],31:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],37:[2,40],41:[2,40],42:[2,40],43:[2,40],46:[2,40],48:[2,40],49:[2,40],50:[2,40],51:[2,40]},{6:[2,41],14:[2,41],16:[2,41],18:[2,41],24:[2,41],26:[2,41],28:[2,41],31:[2,41],32:[2,41],33:[2,41],34:[2,41],35:[2,41],36:[2,41],37:[2,41],41:[2,41],42:[2,41],43:[2,41],46:[2,41],48:[2,41],49:[2,41],50:[2,41],51:[2,41]},{6:[2,42],14:[2,42],16:[2,42],18:[2,42],24:[2,42],26:[2,42],28:[2,42],31:[2,42],32:[2,42],33:[2,42],34:[2,42],35:[2,42],36:[2,42],37:[2,42],41:[2,42],42:[2,42],43:[2,42],46:[2,42],48:[2,42],49:[2,42],50:[2,42],51:[2,42]},{6:[2,43],14:[2,43],16:[2,43],18:[2,43],24:[2,43],26:[2,43],28:[2,43],31:[2,43],32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],37:[2,43],41:[2,43],42:[2,43],43:[2,43],46:[2,43],48:[2,43],49:[2,43],50:[2,43],51:[2,43]},{6:[2,44],14:[2,44],16:[2,44],18:[2,44],24:[2,44],26:[2,44],28:[2,44],31:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],37:[2,44],41:[2,44],42:[2,44],43:[2,44],46:[2,44],48:[2,44],49:[2,44],50:[2,44],51:[2,44]},{12:50,18:[1,10]},{6:[2,46],14:[2,46],16:[2,46],18:[2,46],24:[2,46],26:[2,46],28:[2,46],31:[2,46],32:[2,46],33:[2,46],34:[2,46],35:[2,46],36:[2,46],37:[2,46],41:[2,46],42:[2,46],43:[2,46],46:[2,46],48:[2,46],49:[2,46],50:[2,46],51:[2,46]},{6:[2,49],14:[2,49],16:[2,49],18:[2,49],24:[2,49],26:[2,49],28:[2,49],31:[2,49],32:[2,49],33:[2,49],34:[2,49],35:[2,49],36:[2,49],37:[2,49],41:[2,49],42:[2,49],43:[2,49],46:[2,49],48:[2,49],49:[2,49],50:[2,49],51:[2,49]},{6:[2,47],14:[2,47],16:[2,47],18:[2,47],24:[2,47],26:[2,47],28:[2,47],31:[2,47],32:[2,47],33:[2,47],34:[2,47],35:[2,47],36:[2,47],37:[2,47],41:[2,47],42:[2,47],43:[2,47],46:[2,47],48:[2,47],49:[2,47],50:[2,47],51:[2,47]},{6:[2,9],14:[2,9],16:[2,9],18:[1,51],26:[2,9]},{6:[2,11],14:[2,11],16:[2,11],18:[2,11],26:[2,11]},{6:[2,10],14:[2,10],16:[2,10],18:[1,52],26:[2,10]},{6:[2,13],14:[2,13],16:[2,13],18:[2,13],26:[2,13]},{6:[1,56],8:53,9:[1,55],19:54,20:37,21:[1,38],31:[2,21],33:[2,21],36:[2,21],37:[2,21],41:[2,21],42:[2,21],43:[2,21],46:[2,21],48:[2,21],49:[2,21],51:[2,21]},{6:[2,17],9:[2,17],21:[2,17],31:[2,17],33:[2,17],36:[2,17],37:[2,17],41:[2,17],42:[2,17],43:[2,17],46:[2,17],48:[2,17],49:[2,17],51:[2,17]},{13:57,27:13,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{18:[1,60],22:58,24:[1,59]},{27:61,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{6:[2,28],14:[2,28],16:[2,28],18:[2,28],24:[1,42],26:[2,28],28:[2,28],31:[2,28],32:[2,28],33:[2,28],34:[1,41],35:[1,43],36:[2,28],37:[2,28],39:44,41:[2,28],42:[2,28],43:[2,28],46:[2,28],48:[2,28],49:[2,28],50:[1,45],51:[2,28]},{6:[2,32],14:[2,32],16:[2,32],18:[2,32],24:[2,32],26:[2,32],28:[2,32],31:[2,32],32:[2,32],33:[2,32],34:[2,32],35:[2,32],36:[2,32],37:[2,32],41:[2,32],42:[2,32],43:[2,32],46:[2,32],48:[2,32],49:[2,32],50:[2,32],51:[2,32]},{6:[2,33],14:[2,33],16:[2,33],18:[2,33],24:[2,33],26:[2,33],28:[2,33],31:[2,33],32:[2,33],33:[2,33],34:[2,33],35:[2,33],36:[2,33],37:[2,33],41:[2,33],42:[2,33],43:[2,33],46:[2,33],48:[2,33],49:[2,33],50:[2,33],51:[2,33]},{6:[2,34],14:[2,34],16:[2,34],18:[2,34],24:[2,34],26:[2,34],28:[2,34],31:[2,34],32:[2,34],33:[2,34],34:[2,34],35:[2,34],36:[2,34],37:[2,34],41:[2,34],42:[2,34],43:[2,34],46:[2,34],48:[2,34],49:[2,34],50:[2,34],51:[2,34]},{6:[2,38],14:[2,38],16:[2,38],18:[2,38],24:[2,38],26:[2,38],28:[2,38],31:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],37:[2,38],41:[2,38],42:[2,38],43:[2,38],46:[2,38],48:[2,38],49:[2,38],50:[2,38],51:[2,38]},{6:[2,48],14:[2,48],16:[2,48],18:[2,48],24:[2,48],26:[2,48],28:[2,48],31:[2,48],32:[2,48],33:[2,48],34:[2,48],35:[2,48],36:[2,48],37:[2,48],41:[2,48],42:[2,48],43:[2,48],46:[2,48],48:[2,48],49:[2,48],50:[2,48],51:[2,48]},{28:[1,39],32:[1,62]},{28:[1,39],32:[1,63]},{6:[2,35],14:[2,35],16:[2,35],18:[2,35],24:[1,42],26:[2,35],28:[2,35],31:[2,35],32:[2,35],33:[2,35],34:[1,41],35:[1,43],36:[2,35],37:[2,35],39:44,41:[2,35],42:[2,35],43:[2,35],46:[2,35],48:[2,35],49:[2,35],50:[1,45],51:[2,35]},{6:[2,36],14:[2,36],16:[2,36],18:[2,36],24:[1,42],26:[2,36],28:[2,36],31:[2,36],32:[2,36],33:[2,36],34:[1,41],35:[1,43],36:[2,36],37:[2,36],39:44,41:[2,36],42:[2,36],43:[2,36],46:[2,36],48:[2,36],49:[2,36],50:[1,45],51:[2,36]},{47:[1,64]},{6:[2,12],14:[2,12],16:[2,12],18:[2,12],26:[2,12]},{6:[2,14],14:[2,14],16:[2,14],18:[2,14],26:[2,14]},{1:[2,1]},{6:[2,16],9:[2,16],21:[2,16],31:[2,16],33:[2,16],36:[2,16],37:[2,16],41:[2,16],42:[2,16],43:[2,16],46:[2,16],48:[2,16],49:[2,16],51:[2,16]},{1:[2,2]},{9:[1,65]},{10:66,26:[1,9]},{23:[1,67],25:[1,68]},{23:[1,69]},{23:[2,22],25:[2,22]},{6:[2,26],14:[2,26],16:[2,26],18:[2,26],26:[2,26],28:[1,39],32:[2,26]},{6:[2,30],14:[2,30],16:[2,30],18:[2,30],24:[2,30],26:[2,30],28:[2,30],31:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],37:[2,30],41:[2,30],42:[2,30],43:[2,30],46:[2,30],48:[2,30],49:[2,30],50:[2,30],51:[2,30]},{6:[2,31],14:[2,31],16:[2,31],18:[2,31],24:[2,31],26:[2,31],28:[2,31],31:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],37:[2,31],41:[2,31],42:[2,31],43:[2,31],46:[2,31],48:[2,31],49:[2,31],50:[2,31],51:[2,31]},{6:[2,45],14:[2,45],16:[2,45],18:[2,45],24:[2,45],26:[2,45],28:[2,45],31:[2,45],32:[2,45],33:[2,45],34:[2,45],35:[2,45],36:[2,45],37:[2,45],41:[2,45],42:[2,45],43:[2,45],46:[2,45],48:[2,45],49:[2,45],50:[2,45],51:[2,45]},{1:[2,3]},{6:[2,18],9:[2,18],21:[2,18],31:[2,18],33:[2,18],36:[2,18],37:[2,18],41:[2,18],42:[2,18],43:[2,18],46:[2,18],48:[2,18],49:[2,18],51:[2,18]},{31:[2,19],33:[2,19],36:[2,19],37:[2,19],41:[2,19],42:[2,19],43:[2,19],46:[2,19],48:[2,19],49:[2,19],51:[2,19]},{18:[1,70]},{31:[2,20],33:[2,20],36:[2,20],37:[2,20],41:[2,20],42:[2,20],43:[2,20],46:[2,20],48:[2,20],49:[2,20],51:[2,20]},{23:[2,23],25:[2,23]}],
+defaultActions: {5:[2,4],53:[2,1],55:[2,2],65:[2,3]},
parseError: function parseError(str, hash) {
throw new Error(str);
},
@@ -421,66 +423,72 @@ case 5:if (yy.ruleSection) this.begin('indented')
break;
case 6:return 18
break;
-case 7:yy_.yytext = yy_.yytext.replace(/\\"/g,'"');return 50;
+case 7:yy_.yytext = yy_.yytext.replace(/\\"/g,'"');return 51;
break;
-case 8:yy_.yytext = yy_.yytext.replace(/\\'/g,"'");return 50;
+case 8:yy_.yytext = yy_.yytext.replace(/\\'/g,"'");return 51;
break;
case 9:return 28
break;
-case 10:return 47
+case 10:return 48
break;
-case 11:return 31
+case 11:return 33
break;
-case 12:return 32
+case 12:return 33
break;
case 13:return 33
break;
-case 14:return 24
+case 14:return 31
+break;
+case 15:return 32
+break;
+case 16:return 34
+break;
+case 17:return 24
break;
-case 15:return 34
+case 18:return 35
break;
-case 16:return 41
+case 19:return 42
break;
-case 17:return 25
+case 20:return 25
break;
-case 18:return 42
+case 21:return 43
break;
-case 19:return 21
+case 22:return 21
break;
-case 20:return 23
+case 23:return 23
break;
-case 21:return 36
+case 24:return 37
break;
-case 22:return 35
+case 25:return 36
break;
-case 23:return 48
+case 26:return 49
break;
-case 24:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 48
+case 27:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 49
break;
-case 25:return 42
+case 28:return 43
break;
-case 26:return 40
+case 29:return 41
break;
-case 27:return 14
+case 30:return 14
break;
-case 28:return 16
+case 31:return 16
break;
-case 29:yy.ruleSection = true; return 6
+case 32:yy.ruleSection = true; return 6
break;
-case 30:return 49
+case 33:return 50
break;
-case 31:return 45
+case 34:return 46
break;
-case 32:return 46
+case 35:return 47
break;
-case 33:/* ignore bad characters */
+case 36:/* ignore bad characters */
break;
-case 34:return 9
+case 37:return 9
break;
}
};
-lexer.rules = [/^.*\n+/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^.+/,/^\n+/,/^\s+/,/^[a-zA-Z_][a-zA-Z0-9_-]*/,/^"(\\\\|\\"|[^"])*"/,/^'(\\\\|\\'|[^'])*'/,/^\|/,/^\[(\\\]|[^\]])*\]/,/^\(/,/^\)/,/^\+/,/^\*/,/^\?/,/^\^/,/^,/,/^<<EOF>>/,/^</,/^>/,/^\/!/,/^\//,/^\\([0-7]{1,3}|[rfntvsSbBwWdD]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4})/,/^\\./,/^\$/,/^\./,/^%s\b/,/^%x\b/,/^%%/,/^\{\d+(,\s?\d+|,)?\}/,/^\{/,/^\}/,/^./,/^$/];
-lexer.conditions = {"indented":{"rules":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"inclusive":true},"trail":{"rules":[0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"inclusive":true},"INITIAL":{"rules":[2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"inclusive":true}};return lexer;})()
+lexer.rules = [/^.*\n+/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^.+/,/^\n+/,/^\s+/,/^[a-zA-Z_][a-zA-Z0-9_-]*/,/^"(\\\\|\\"|[^"])*"/,/^'(\\\\|\\'|[^'])*'/,/^\|/,/^\[(\\\]|[^\]])*\]/,/^\(\?:/,/^\(\?=/,/^\(\?!/,/^\(/,/^\)/,/^\+/,/^\*/,/^\?/,/^\^/,/^,/,/^<<EOF>>/,/^</,/^>/,/^\/!/,/^\//,/^\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4})/,/^\\./,/^\$/,/^\./,/^%s\b/,/^%x\b/,/^%%/,/^\{\d+(,\s?\d+|,)?\}/,/^\{/,/^\}/,/^./,/^$/];
+lexer.conditions = {"indented":{"rules":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true},"trail":{"rules":[0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true},"INITIAL":{"rules":[2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true}};return lexer;})()
parser.lexer = lexer;
return parser;
})();
View
203 lib/jison/util/nomnom.js
@@ -1,203 +0,0 @@
-ArgParser = function(options, parserOpts) {
- parserOpts = parserOpts || {};
- this.print = parserOpts.printFunc || this.print;
- this.script = parserOpts.script;
- this.printHelp = parserOpts.printHelp;
- if(this.printHelp == undefined)
- this.printHelp = true;
-
- var opts = options || [];
- if(opts.length == undefined) {
- // options is a hash not an array
- opts = [];
- for(var name in options) {
- var option = options[name];
- option.name = name;
- opts.push(option);
- }
- }
- this.options = opts.map(function(opt) {
- return new Option(opt);
- });
-}
-
-ArgParser.prototype = {
- print : function(str) {
- require("sys").puts(str);
- process.exit(0);
- },
-
- option : function(arg) {
- var match = new Option({});
- this.options.forEach(function(option) {
- if(option.matches(arg))
- match = option;
- });
- return match;
- },
-
- optName : function(arg) {
- var option = this.option(arg);
- return this.option(arg).name || arg;
- },
-
- "default" : function(arg) {
- return this.option(arg)["default"] || true;
- },
-
- expectsValue : function(arg) {
- return this.option(arg).expectsValue();
- },
-
- parse : function(args) {
- args = args || process.argv.slice(2);
-
- if(this.printHelp && (args.indexOf("--help") != -1
- || args.indexOf("-h") != -1))
- this.print(this.helpString());
-
- var ret = {};
- this.options.forEach(function(option) {
- ret[option.name] = option["default"];
- }, this);
-
- args = args.concat([""]).map(function(arg) {
- return new Arg(arg);
- });
- var positionals = [];
- var that = this;
-
- args.reduce(function(arg, val) {
- /* word */
- if(arg.isValue()) {
- positionals.push(arg.value);
- }
- /* -c */
- else if(arg.chars) {
- /* -cfv */
- (arg.chars).forEach(function(ch) {
- ret[this.optName(ch)] = this["default"](ch);
- }, that);
- /* -c 3 */
- if(val.isValue()) {
- if(that.expectsValue(arg.lastChar)) {
- ret[that.optName(arg.lastChar)] = val.value;
- return new Arg(""); // skip next turn - swallow arg
- }
- }
- }
- /* --config=tests.json */
- else if(arg.lg) {
- var value = arg.value;
- /* --debug */
- if(value == undefined)
- value = that["default"](arg.lg)
- ret[that.optName(arg.lg)] = value;
- }
- return val;
- });
-
- positionals.forEach(function(pos, index) {
- ret[this.optName(index)] = pos;
- }, this);
-
- return ret;
- },
-
- helpString : function() {
- var str = "usage: " + (this.script || "<script>");
-
- var positionals = this.options.filter(function(opt) {
- return opt.position != undefined;
- }).sort(function(opt1, opt2) {
- return opt1.position > opt2.position;
- });
- // assume there are no gaps in the specified pos. args
- positionals.forEach(function(pos) {
- str += " <" + (pos.name || "arg" + pos.position) + ">";
- });
- str += " [options]\n\n";
-
- positionals.forEach(function(pos) {
- str += pos.name + "\t" + (pos.help || "") + "\n";
- });
- str += "\noptions:\n"
-
- this.options.forEach(function(option) {
- if(option.position == undefined)
- str += option.string + "\t" + (option.help || "") + "\n";
- });
- return str;
- }
-}
-
-Option = function(opt) {
- this.string = opt.string || (opt.name ? "--" + opt.name : "");
- var matches = /^(?:\-(\w+?)(?:\s+([^-][^\s]*))?)?\,?\s*(?:\-\-(.+?)(?:=(.+))?)?$/
- .exec(this.string);
- this.sh = matches[1];
- this.metavar = matches[2] || matches[4]
- this.lg = matches[3];
-
- this.name = opt.name || this.lg || this.sh;
- this["default"] = opt["default"];
- this.help = opt.help;
- this.position = opt.position;
-}
-
-Option.prototype = {
- matches : function(arg) {
- return this.lg == arg || this.sh == arg || this.position == arg;
- },
-
- expectsValue : function() {
- return this.metavar || this["default"];
- }
-}
-
-Arg = function(str) {
- // "-l", "log.txt", or "--logfile=log.txt"
- this.str = str;
-}
-
-Arg.prototype = {
- shRegex : /^\-(\w+?)$/,
-
- lgRegex : /^\-\-(.+?)(?:=(.+))?$/,
-
- valRegex : /^[^\-]/,
-
- get chars() {
- var matches = this.shRegex.exec(this.str);
- return matches && matches[1].split("");
- },
-
- get value() {
- if(this.str) {
- var val = this.valRegex.test(this.str) ? this.str
- : this.lgRegex.exec(this.str)[2];
- try { // try to infer type by JSON parsing the string
- val = JSON.parse(val)
- } catch(e) {}
- return val;
- }
- },
-
- get lg() {
- var matches = this.lgRegex.exec(this.str);
- return matches && matches[1];
- },
-
- get lastChar() {
- return this.str[this.str.length - 1];
- },
-
- isValue : function() {
- return this.str && this.valRegex.test(this.str);
- }
-}
-
-exports.ArgParser = ArgParser;
-exports.parseArgs = function(opts, parserOpts, args) {
- return (new ArgParser(opts, parserOpts)).parse(args);
-};
View
6 package.json
@@ -2,7 +2,7 @@
"author": "Zach Carter <zach@carter.name> (http://zaa.ch)",
"name": "jison",
"description": "A parser generator with Bison's API",
- "version": "0.2.8",
+ "version": "0.2.11",
"keywords": [
"jison",
"bison",
@@ -32,7 +32,9 @@
"engines": {
"node": "0.4 || 0.5"
},
- "dependencies": {},
+ "dependencies": {
+ "nomnom": ">= 0.4.3"
+ },
"devDependencies": {
"test": "*",
"jison": "*",
View
2  src/jisonlex.jison
@@ -126,6 +126,8 @@ regex_concat
regex_base
: '(' regex_list ')'
{ $$ = '('+$2+')'; }
+ | SPECIAL_GROUP regex_list ')'
+ { $$ = $1+$2+')'; }
| regex_base '+'
{ $$ = $1+'+'; }
| regex_base '*'
View
5 src/jisonlex.jisonlex
@@ -13,6 +13,9 @@
"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'");return 'STRING_LIT';
"|" return '|'
"["("\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'
+"(?:" return 'SPECIAL_GROUP'
+"(?=" return 'SPECIAL_GROUP'
+"(?!" return 'SPECIAL_GROUP'
"(" return '('
")" return ')'
"+" return '+'
@@ -25,7 +28,7 @@
">" return '>'
"/!" return '/!'
"/" return '/'
-"\\"([0-7]{1,3}|[rfntvsSbBwWdD]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'
+"\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'
"\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'
"$" return '$'
"." return '.'
View
24 tests/grammar/lex_parse.js
@@ -170,7 +170,7 @@ exports["test escape things"] = function () {
var lexgrammar = '%%\n\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}';
var expected = {
rules: [
- ["\"'\\*i\\b", "return 1;"],
+ ["\"'\\\\\\*i\\b", "return 1;"],
["a\\b", "return 2;"],
["\\cA", ""],
["\\012", ""],
@@ -202,3 +202,25 @@ exports["test unicode"] = function () {
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
}
+
+exports["test bugs"] = function () {
+ var lexgrammar = '%%\n\\\'([^\\\\\']+|\\\\(\\n|.))*?\\\' return 1;';
+ var expected = {
+ rules: [
+ ["'([^\\\\']+|\\\\(\\n|.))*?'", "return 1;"]
+ ]
+ };
+
+ assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
+}
+
+exports["test special groupings"] = function () {
+ var lexgrammar = '%%\n(?:"foo"|"bar")\\(\\) return 1;';
+ var expected = {
+ rules: [
+ ["(?:foo|bar)\\(\\)", "return 1;"]
+ ]
+ };
+
+ assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
+}
View
186 web/content/assets/js/jison.js
@@ -584,12 +584,16 @@ lrGeneratorMixin.Item = typal.construct({
eq: function (e) {
return e.id === this.id;
},
+ handleToString: function () {
+ var handle = this.production.handle.slice(0);
+ handle[this.dotPosition] = '.'+(handle[this.dotPosition]||'');
+ return handle.join(' ');
+ },
toString: function () {
var temp = this.production.handle.slice(0);
temp[this.dotPosition] = '.'+(temp[this.dotPosition]||'');
- return '['+this.production.symbol+" -> "+temp.join(' ')
- +(this.follows.length === 0 ? "" : ", "+this.follows.join('/'))
- +']';
+ return this.production.symbol+" -> "+temp.join(' ')
+ +(this.follows.length === 0 ? "" : " #lookaheads= "+this.follows.join(' '));
}
});
@@ -730,6 +734,7 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
var states = [],
nonterminals = this.nonterminals,
operators = this.operators,
+ conflictedStates = {}, // array of [state, token] tuples
self = this,
s = 1, // shift
r = 2, // reduce
@@ -785,7 +790,8 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
if (sol.bydefault) {
self.conflicts++;
if (!self.DEBUG) {
- self.warn('Conflict in grammar (state:',k, ', token:',stackSymbol, ")\n ", printAction(sol.r, self), "\n ", printAction(sol.s, self));
+ self.warn('Conflict in grammar: multiple actions possible when lookahead token is ',stackSymbol,' in state ',k, "\n- ", printAction(sol.r, self), "\n- ", printAction(sol.s, self));
+ conflictedStates[k] = true;
}
if (self.options.noDefaultResolve) {
if (!(action[0] instanceof Array))
@@ -808,6 +814,14 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
});
+ if (!self.DEBUG) {
+ self.warn("\nStates with conflicts:");
+ each(conflictedStates, function (val, state) {
+ self.warn('State '+state);
+ self.warn(' ',itemSets.item(state).join("\n "));
+ });
+ }
+
return states;
};
@@ -949,8 +963,8 @@ function commonjsMain (args) {
// debug mixin for LR parser generators
function printAction (a, gen) {
- var s = a[0] == 1 ? 'shift '+(gen.symbols[a[1]] || a[1]) :
- a[0] == 2 ? 'reduce by '+gen.productions[a[1]] :
+ var s = a[0] == 1 ? 'shift token (then go to state '+a[1]+')' :
+ a[0] == 2 ? 'reduce by rule: '+gen.productions[a[1]] :
'accept' ;
return s;
@@ -965,7 +979,7 @@ var lrGeneratorDebug = {
if (this.conflicts > 0) {
this.resolutions.forEach(function (r, i) {
if (r[2].bydefault) {
- self.warn('Conflict at state:',r[0], ', Token:',r[1], "\n ", printAction(r[2].r, self), "\n ", printAction(r[2].s, self));
+ self.warn('Conflict at state: ',r[0], ', token: ',r[1], "\n ", printAction(r[2].r, self), "\n ", printAction(r[2].s, self));
}
});
this.trace("\n"+this.conflicts+" Conflict(s) found in grammar.");
@@ -1756,7 +1770,7 @@ RegExpLexer.prototype = {
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-1 : this.yylloc.last_column + match.length}
+ last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
this.yytext += match[0];
this.match += match[0];
this.matches = match;
@@ -1897,7 +1911,7 @@ jisonlex.parse = exports.parse = function parse () {
return parse_.apply(jisonlex, arguments);
};
-function encodeRE (s) { return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1'); }
+function encodeRE (s) { return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g,'\\u$1'); }
jisonlex.yy = {
prepareString: function (s) {
@@ -2109,9 +2123,9 @@ require.def("jison/util/bnf-parser",{factory:function(require,exports,module){
var bnf = (function(){
var parser = {trace: function trace() { },
yy: {},
-symbols_: {"error":2,"spec":3,"declaration_list":4,"%%":5,"grammar":6,"EOF":7,"declaration":8,"START":9,"id":10,"LEX_BLOCK":11,"operator":12,"associativity":13,"token_list":14,"LEFT":15,"RIGHT":16,"NONASSOC":17,"symbol":18,"production_list":19,"production":20,":":21,"handle_list":22,";":23,"|":24,"handle_action":25,"handle":26,"prec":27,"action":28,"PREC":29,"STRING":30,"ID":31,"ACTION":32,"$accept":0,"$end":1},
-terminals_: {2:"error",5:"%%",7:"EOF",9:"START",11:"LEX_BLOCK",15:"LEFT",16:"RIGHT",17:"NONASSOC",21:":",23:";",24:"|",29:"PREC",30:"STRING",31:"ID",32:"ACTION"},
-productions_: [0,[3,4],[3,5],[4,2],[4,0],[8,2],[8,1],[8,1],[12,2],[13,1],[13,1],[13,1],[14,2],[14,1],[6,1],[19,2],[19,1],[20,4],[22,3],[22,1],[25,3],[26,2],[26,0],[27,2],[27,0],[18,1],[18,1],[10,1],[28,1],[28,0]],
+symbols_: {"error":2,"spec":3,"declaration_list":4,"%%":5,"grammar":6,"EOF":7,"declaration":8,"START":9,"id":10,"LEX_BLOCK":11,"operator":12,"associativity":13,"token_list":14,"LEFT":15,"RIGHT":16,"NONASSOC":17,"symbol":18,"production_list":19,"production":20,":":21,"handle_list":22,";":23,"|":24,"handle_action":25,"handle":26,"prec":27,"action":28,"PREC":29,"STRING":30,"ID":31,"{":32,"action_body":33,"}":34,"ACTION":35,"ACTION_BODY":36,"$accept":0,"$end":1},
+terminals_: {2:"error",5:"%%",7:"EOF",9:"START",11:"LEX_BLOCK",15:"LEFT",16:"RIGHT",17:"NONASSOC",21:":",23:";",24:"|",29:"PREC",30:"STRING",31:"ID",32:"{",34:"}",35:"ACTION",36:"ACTION_BODY"},
+productions_: [0,[3,4],[3,5],[4,2],[4,0],[8,2],[8,1],[8,1],[12,2],[13,1],[13,1],[13,1],[14,2],[14,1],[6,1],[19,2],[19,1],[20,4],[22,3],[22,1],[25,3],[26,2],[26,0],[27,2],[27,0],[18,1],[18,1],[10,1],[28,3],[28,1],[28,0],[33,0],[33,1],[33,5]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var $0 = $$.length - 1;
@@ -2160,7 +2174,7 @@ case 20:this.$ = [($$[$0-2].length ? $$[$0-2].join(' ') : '')];
if($$[$0]) this.$.push($$[$0]);
if($$[$0-1]) this.$.push($$[$0-1]);
if (this.$.length === 1) this.$ = this.$[0];
-
+
break;
case 21:this.$ = $$[$0-1]; this.$.push($$[$0])
break;
@@ -2176,13 +2190,21 @@ case 26:this.$ = yytext;
break;
case 27:this.$ = yytext;
break;
-case 28:this.$ = yytext;
+case 28:this.$ = $$[$0-1];
+break;
+case 29:this.$ = $$[$0];
break;
-case 29:this.$ = '';
+case 30:this.$ = '';
+break;
+case 31:this.$ = '';
+break;
+case 32:this.$ = yytext;
+break;
+case 33:this.$ = $$[$0-4]+$$[$0-3]+$$[$0-2]+$$[$0-1]+$$[$0];
break;
}
},
-table: [{3:1,4:2,5:[2,4],9:[2,4],11:[2,4],15:[2,4],16:[2,4],17:[2,4]},{1:[3]},{5:[1,3],8:4,9:[1,5],11:[1,6],12:7,13:8,15:[1,9],16:[1,10],17:[1,11]},{6:12,10:15,19:13,20:14,31:[1,16]},{5:[2,3],9:[2,3],11:[2,3],15:[2,3],16:[2,3],17:[2,3]},{10:17,31:[1,16]},{5:[2,6],9:[2,6],11:[2,6],15:[2,6],16:[2,6],17:[2,6]},{5:[2,7],9:[2,7],11:[2,7],15:[2,7],16:[2,7],17:[2,7]},{10:20,14:18,18:19,30:[1,21],31:[1,16]},{30:[2,9],31:[2,9]},{30:[2,10],31:[2,10]},{30:[2,11],31:[2,11]},{5:[1,23],7:[1,22]},{5:[2,14],7:[2,14],10:15,20:24,31:[1,16]},{5:[2,16],7:[2,16],31:[2,16]},{21:[1,25]},{5:[2,27],9:[2,27],11:[2,27],15:[2,27],16:[2,27],17:[2,27],21:[2,27],23:[2,27],24:[2,27],29:[2,27],30:[2,27],31:[2,27],32:[2,27]},{5:[2,5],9:[2,5],11:[2,5],15:[2,5],16:[2,5],17:[2,5]},{5:[2,8],9:[2,8],10:20,11:[2,8],15:[2,8],16:[2,8],17:[2,8],18:26,30:[1,21],31:[1,16]},{5:[2,13],9:[2,13],11:[2,13],15:[2,13],16:[2,13],17:[2,13],30:[2,13],31:[2,13]},{5:[2,25],9:[2,25],11:[2,25],15:[2,25],16:[2,25],17:[2,25],23:[2,25],24:[2,25],29:[2,25],30:[2,25],31:[2,25],32:[2,25]},{5:[2,26],9:[2,26],11:[2,26],15:[2,26],16:[2,26],17:[2,26],23:[2,26],24:[2,26],29:[2,26],30:[2,26],31:[2,26],32:[2,26]},{1:[2,1]},{7:[1,27]},{5:[2,15],7:[2,15],31:[2,15]},{22:28,23:[2,22],24:[2,22],25:29,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22]},{5:[2,12],9:[2,12],11:[2,12],15:[2,12],16:[2,12],17:[2,12],30:[2,12],31:[2,12]},{1:[2,2]},{23:[1,31],24:[1,32]},{23:[2,19],24:[2,19]},{10:20,18:34,23:[2,24],24:[2,24],27:33,29:[1,35],30:[1,21],31:[1,16],32:[2,24]},{5:[2,17],7:[2,17],31:[2,17]},{23:[2,22],24:[2,22],25:36,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22]},{23:[2,29],24:[2,29],28:37,32:[1,38]},{23:[2,21],24:[2,21],29:[2,21],30:[2,21],31:[2,21],32:[2,21]},{10:20,18:39,30:[1,21],31:[1,16]},{23:[2,18],24:[2,18]},{23:[2,20],24:[2,20]},{23:[2,28],24:[2,28]},{23:[2,23],24:[2,23],32:[2,23]}],
+table: [{3:1,4:2,5:[2,4],9:[2,4],11:[2,4],15:[2,4],16:[2,4],17:[2,4]},{1:[3]},{5:[1,3],8:4,9:[1,5],11:[1,6],12:7,13:8,15:[1,9],16:[1,10],17:[1,11]},{6:12,10:15,19:13,20:14,31:[1,16]},{5:[2,3],9:[2,3],11:[2,3],15:[2,3],16:[2,3],17:[2,3]},{10:17,31:[1,16]},{5:[2,6],9:[2,6],11:[2,6],15:[2,6],16:[2,6],17:[2,6]},{5:[2,7],9:[2,7],11:[2,7],15:[2,7],16:[2,7],17:[2,7]},{10:20,14:18,18:19,30:[1,21],31:[1,16]},{30:[2,9],31:[2,9]},{30:[2,10],31:[2,10]},{30:[2,11],31:[2,11]},{5:[1,23],7:[1,22]},{5:[2,14],7:[2,14],10:15,20:24,31:[1,16]},{5:[2,16],7:[2,16],31:[2,16]},{21:[1,25]},{5:[2,27],9:[2,27],11:[2,27],15:[2,27],16:[2,27],17:[2,27],21:[2,27],23:[2,27],24:[2,27],29:[2,27],30:[2,27],31:[2,27],32:[2,27],35:[2,27]},{5:[2,5],9:[2,5],11:[2,5],15:[2,5],16:[2,5],17:[2,5]},{5:[2,8],9:[2,8],10:20,11:[2,8],15:[2,8],16:[2,8],17:[2,8],18:26,30:[1,21],31:[1,16]},{5:[2,13],9:[2,13],11:[2,13],15:[2,13],16:[2,13],17:[2,13],30:[2,13],31:[2,13]},{5:[2,25],9:[2,25],11:[2,25],15:[2,25],16:[2,25],17:[2,25],23:[2,25],24:[2,25],29:[2,25],30:[2,25],31:[2,25],32:[2,25],35:[2,25]},{5:[2,26],9:[2,26],11:[2,26],15:[2,26],16:[2,26],17:[2,26],23:[2,26],24:[2,26],29:[2,26],30:[2,26],31:[2,26],32:[2,26],35:[2,26]},{1:[2,1]},{7:[1,27]},{5:[2,15],7:[2,15],31:[2,15]},{22:28,23:[2,22],24:[2,22],25:29,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22],35:[2,22]},{5:[2,12],9:[2,12],11:[2,12],15:[2,12],16:[2,12],17:[2,12],30:[2,12],31:[2,12]},{1:[2,2]},{23:[1,31],24:[1,32]},{23:[2,19],24:[2,19]},{10:20,18:34,23:[2,24],24:[2,24],27:33,29:[1,35],30:[1,21],31:[1,16],32:[2,24],35:[2,24]},{5:[2,17],7:[2,17],31:[2,17]},{23:[2,22],24:[2,22],25:36,26:30,29:[2,22],30:[2,22],31:[2,22],32:[2,22],35:[2,22]},{23:[2,30],24:[2,30],28:37,32:[1,38],35:[1,39]},{23:[2,21],24:[2,21],29:[2,21],30:[2,21],31:[2,21],32:[2,21],35:[2,21]},{10:20,18:40,30:[1,21],31:[1,16]},{23:[2,18],24:[2,18]},{23:[2,20],24:[2,20]},{32:[2,31],33:41,34:[2,31],36:[1,42]},{23:[2,29],24:[2,29]},{23:[2,23],24:[2,23],32:[2,23],35:[2,23]},{32:[1,44],34:[1,43]},{32:[2,32],34:[2,32]},{23:[2,28],24:[2,28]},{32:[2,31],33:45,34:[2,31],36:[1,42]},{32:[1,44],34:[1,46]},{32:[2,31],33:47,34:[2,31],36:[1,42]},{32:[1,44],34:[2,33]}],
defaultActions: {22:[2,1],27:[2,2]},
parseError: function parseError(str, hash) {
throw new Error(str);
@@ -2205,6 +2227,8 @@ parse: function parse(input) {
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
+ if (typeof this.lexer.yylloc == 'undefined')
+ this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
@@ -2443,7 +2467,7 @@ next:function () {
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-1 : this.yylloc.last_column + match.length}
+ last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
this.yytext += match[0];
this.match += match[0];
this.matches = match;
@@ -2459,7 +2483,7 @@ next:function () {
if (this._input === "") {
return this.EOF;
} else {
- this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
+ this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
{text: "", token: null, line: this.yylineno});
}
},
@@ -2518,22 +2542,28 @@ case 15:return 11;
break;
case 16:/* ignore unrecognized decl */
break;
-case 17: /* ignore type */
+case 17:/* ignore type */
break;
-case 18:yy_.yytext = yy_.yytext.substr(2, yy_.yyleng-4); return 32;
+case 18:yy_.yytext = yy_.yytext.substr(2, yy_.yyleng-4); return 35;
break;
-case 19:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 32;
+case 19:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 35;
break;
-case 20:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 32;
+case 20:yy.depth=0; this.begin('action'); return 32;
break;
case 21:/* ignore bad characters */
break;
case 22:return 7;
break;
+case 23:return 36;
+break;
+case 24:yy.depth++; return 32;
+break;
+case 25:yy.depth==0? this.begin('INITIAL') : yy.depth--; return 34;
+break;
}
};
-lexer.rules = [/^\s+/,/^\/\/.*/,/^\/\*[^*]*\*/,/^[a-zA-Z][a-zA-Z0-9_-]*/,/^"[^"]+"/,/^'[^']+'/,/^:/,/^;/,/^\|/,/^%%/,/^%prec\b/,/^%start\b/,/^%left\b/,/^%right\b/,/^%nonassoc\b/,/^%lex[\w\W]*?\/lex\b/,/^%[a-zA-Z]+[^\n]*/,/^<[a-zA-Z]*>/,/^\{\{[\w\W]*?\}\}/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^./,/^$/];
-lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"inclusive":true}};return lexer;})()
+lexer.rules = [/^\s+/,/^\/\/.*/,/^\/\*[^*]*\*/,/^[a-zA-Z][a-zA-Z0-9_-]*/,/^"[^"]+"/,/^'[^']+'/,/^:/,/^;/,/^\|/,/^%%/,/^%prec\b/,/^%start\b/,/^%left\b/,/^%right\b/,/^%nonassoc\b/,/^%lex[\w\W]*?\/lex\b/,/^%[a-zA-Z]+[^\n]*/,/^<[a-zA-Z]*>/,/^\{\{[\w\W]*?\}\}/,/^%\{(.|\n)*?%\}/,/^\{/,/^./,/^$/,/^[^{}]+/,/^\{/,/^\}/];
+lexer.conditions = {"action":{"rules":[23,24,25],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"inclusive":true}};return lexer;})()
parser.lexer = lexer;
return parser;
})();
@@ -2563,9 +2593,9 @@ require.def("jison/util/lex-parser",{factory:function(require,exports,module){
var jisonlex = (function(){
var parser = {trace: function trace() { },
yy: {},
-symbols_: {"error":2,"lex":3,"definitions":4,"include":5,"%%":6,"rules":7,"epilogue":8,"EOF":9,"action":10,"definition":11,"name":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"NAME":18,"rule":19,"start_conditions":20,"<":21,"name_list":22,">":23,"*":24,",":25,"ACTION":26,"regex_list":27,"|":28,"regex_concat":29,"regex_base":30,"(":31,")":32,"+":33,"?":34,"/":35,"/!":36,"name_expansion":37,"range_regex":38,"any_group_regex":39,".":40,"^":41,"$":42,"string":43,"escape_char":44,"{":45,"}":46,"ANY_GROUP_REGEX":47,"ESCAPE_CHAR":48,"RANGE_REGEX":49,"STRING_LIT":50,"$accept":0,"$end":1},
-terminals_: {2:"error",6:"%%",9:"EOF",14:"START_INC",16:"START_EXC",18:"NAME",21:"<",23:">",24:"*",25:",",26:"ACTION",28:"|",31:"(",32:")",33:"+",34:"?",35:"/",36:"/!",40:".",41:"^",42:"$",45:"{",46:"}",47:"ANY_GROUP_REGEX",48:"ESCAPE_CHAR",49:"RANGE_REGEX",50:"STRING_LIT"},
-productions_: [0,[3,5],[8,1],[8,2],[5,1],[5,0],[4,2],[4,0],[11,2],[11,2],[11,2],[15,1],[15,2],[17,1],[17,2],[12,1],[7,2],[7,1],[19,3],[20,3],[20,3],[20,0],[22,1],[22,3],[10,1],[13,1],[27,3],[27,1],[29,2],[29,1],[30,3],[30,2],[30,2],[30,2],[30,2],[30,2],[30,1],[30,2],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[37,3],[39,1],[44,1],[38,1],[43,1]],
+symbols_: {"error":2,"lex":3,"definitions":4,"include":5,"%%":6,"rules":7,"epilogue":8,"EOF":9,"action":10,"definition":11,"name":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"NAME":18,"rule":19,"start_conditions":20,"<":21,"name_list":22,">":23,"*":24,",":25,"ACTION":26,"regex_list":27,"|":28,"regex_concat":29,"regex_base":30,"(":31,")":32,"SPECIAL_GROUP":33,"+":34,"?":35,"/":36,"/!":37,"name_expansion":38,"range_regex":39,"any_group_regex":40,".":41,"^":42,"$":43,"string":44,"escape_char":45,"{":46,"}":47,"ANY_GROUP_REGEX":48,"ESCAPE_CHAR":49,"RANGE_REGEX":50,"STRING_LIT":51,"$accept":0,"$end":1},
+terminals_: {2:"error",6:"%%",9:"EOF",14:"START_INC",16:"START_EXC",18:"NAME",21:"<",23:">",24:"*",25:",",26:"ACTION",28:"|",31:"(",32:")",33:"SPECIAL_GROUP",34:"+",35:"?",36:"/",37:"/!",41:".",42:"^",43:"$",46:"{",47:"}",48:"ANY_GROUP_REGEX",49:"ESCAPE_CHAR",50:"RANGE_REGEX",51:"STRING_LIT"},
+productions_: [0,[3,5],[8,1],[8,2],[5,1],[5,0],[4,2],[4,0],[11,2],[11,2],[11,2],[15,1],[15,2],[17,1],[17,2],[12,1],[7,2],[7,1],[19,3],[20,3],[20,3],[20,0],[22,1],[22,3],[10,1],[13,1],[27,3],[27,1],[29,2],[29,1],[30,3],[30,3],[30,2],[30,2],[30,2],[30,2],[30,2],[30,1],[30,2],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[38,3],[40,1],[45,1],[39,1],[44,1]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var $0 = $$.length - 1;
@@ -2624,7 +2654,7 @@ break;
case 24: this.$ = yytext;
break;
case 25: this.$ = $$[$0];
- if (this.$.match(/[\w\d]$/))
+ if (this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/))
this.$ += "\\b";
break;
@@ -2634,38 +2664,40 @@ case 28: this.$ = $$[$0-1]+$$[$0];
break;
case 30: this.$ = '('+$$[$0-1]+')';
break;
-case 31: this.$ = $$[$0-1]+'+';
+case 31: this.$ = $$[$0-2]+$$[$0-1]+')';
break;
-case 32: this.$ = $$[$0-1]+'*';
+case 32: this.$ = $$[$0-1]+'+';
break;
-case 33: this.$ = $$[$0-1]+'?';
+case 33: this.$ = $$[$0-1]+'*';
break;
-case 34: this.$ = '(?='+$$[$0]+')';
+case 34: this.$ = $$[$0-1]+'?';
break;
-case 35: this.$ = '(?!'+$$[$0]+')';
+case 35: this.$ = '(?='+$$[$0]+')';
break;
-case 37: this.$ = $$[$0-1]+$$[$0];
+case 36: this.$ = '(?!'+$$[$0]+')';
break;
-case 39: this.$ = '.';
+case 38: this.$ = $$[$0-1]+$$[$0];
break;
-case 40: this.$ = '^';
+case 40: this.$ = '.';
break;
-case 41: this.$ = '$';
+case 41: this.$ = '^';
break;
-case 44: this.$ = '{'+$$[$0-1]+'}';
+case 42: this.$ = '$';
break;
-case 45: this.$ = yytext;
+case 45: this.$ = '{'+$$[$0-1]+'}';
break;
case 46: this.$ = yytext;
break;
case 47: this.$ = yytext;
break;
-case 48: this.$ = yy.prepareString(yytext.substr(1, yytext.length-2));
+case 48: this.$ = yytext;
+break;
+case 49: this.$ = yy.prepareString(yytext.substr(1, yytext.length-2));
break;
}
},
-table: [{3:1,4:2,6:[2,7],14:[2,7],16:[2,7],18:[2,7],26:[2,7]},{1:[3]},{5:3,6:[2,5],10:5,11:4,12:6,14:[1,7],16:[1,8],18:[1,10],26:[1,9]},{6:[1,11]},{6:[2,6],14:[2,6],16:[2,6],18:[2,6],26:[2,6]},{6:[2,4]},{13:12,27:13,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{15:30,18:[1,31]},{17:32,18:[1,33]},{6:[2,24],9:[2,24],21:[2,24],31:[2,24],35:[2,24],36:[2,24],40:[2,24],41:[2,24],42:[2,24],45:[2,24],47:[2,24],48:[2,24],50:[2,24]},{31:[2,15],35:[2,15],36:[2,15],40:[2,15],41:[2,15],42:[2,15],45:[2,15],46:[2,15],47:[2,15],48:[2,15],50:[2,15]},{7:34,19:35,20:36,21:[1,37],31:[2,21],35:[2,21],36:[2,21],40:[2,21],41:[2,21],42:[2,21],45:[2,21],47:[2,21],48:[2,21],50:[2,21]},{6:[2,8],14:[2,8],16:[2,8],18:[2,8],26:[2,8]},{6:[2,25],14:[2,25],16:[2,25],18:[2,25],26:[2,25],28:[1,38]},{6:[2,27],14:[2,27],16:[2,27],18:[2,27],26:[2,27],28:[2,27],30:39,31:[1,16],32:[2,27],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{6:[2,29],14:[2,29],16:[2,29],18:[2,29],24:[1,41],26:[2,29],28:[2,29],31:[2,29],32:[2,29],33:[1,40],34:[1,42],35:[2,29],36:[2,29],38:43,40:[2,29],41:[2,29],42:[2,29],45:[2,29],47:[2,29],48:[2,29],49:[1,44],50:[2,29]},{27:45,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{30:46,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{30:47,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{6:[2,36],14:[2,36],16:[2,36],18:[2,36],24:[2,36],26:[2,36],28:[2,36],31:[2,36],32:[2,36],33:[2,36],34:[2,36],35:[2,36],36:[2,36],40:[2,36],41:[2,36],42:[2,36],45:[2,36],47:[2,36],48:[2,36],49:[2,36],50:[2,36]},{6:[2,38],14:[2,38],16:[2,38],18:[2,38],24:[2,38],26:[2,38],28:[2,38],31:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],41:[2,38],42:[2,38],45:[2,38],47:[2,38],48:[2,38],49:[2,38],50:[2,38]},{6:[2,39],14:[2,39],16:[2,39],18:[2,39],24:[2,39],26:[2,39],28:[2,39],31:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],41:[2,39],42:[2,39],45:[2,39],47:[2,39],48:[2,39],49:[2,39],50:[2,39]},{6:[2,40],14:[2,40],16:[2,40],18:[2,40],24:[2,40],26:[2,40],28:[2,40],31:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[2,40],42:[2,40],45:[2,40],47:[2,40],48:[2,40],49:[2,40],50:[2,40]},{6:[2,41],14:[2,41],16:[2,41],18:[2,41],24:[2,41],26:[2,41],28:[2,41],31:[2,41],32:[2,41],33:[2,41],34:[2,41],35:[2,41],36:[2,41],40:[2,41],41:[2,41],42:[2,41],45:[2,41],47:[2,41],48:[2,41],49:[2,41],50:[2,41]},{6:[2,42],14:[2,42],16:[2,42],18:[2,42],24:[2,42],26:[2,42],28:[2,42],31:[2,42],32:[2,42],33:[2,42],34:[2,42],35:[2,42],36:[2,42],40:[2,42],41:[2,42],42:[2,42],45:[2,42],47:[2,42],48:[2,42],49:[2,42],50:[2,42]},{6:[2,43],14:[2,43],16:[2,43],18:[2,43],24:[2,43],26:[2,43],28:[2,43],31:[2,43],32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],41:[2,43],42:[2,43],45:[2,43],47:[2,43],48:[2,43],49:[2,43],50:[2,43]},{12:48,18:[1,10]},{6:[2,45],14:[2,45],16:[2,45],18:[2,45],24:[2,45],26:[2,45],28:[2,45],31:[2,45],32:[2,45],33:[2,45],34:[2,45],35:[2,45],36:[2,45],40:[2,45],41:[2,45],42:[2,45],45:[2,45],47:[2,45],48:[2,45],49:[2,45],50:[2,45]},{6:[2,48],14:[2,48],16:[2,48],18:[2,48],24:[2,48],26:[2,48],28:[2,48],31:[2,48],32:[2,48],33:[2,48],34:[2,48],35:[2,48],36:[2,48],40:[2,48],41:[2,48],42:[2,48],45:[2,48],47:[2,48],48:[2,48],49:[2,48],50:[2,48]},{6:[2,46],14:[2,46],16:[2,46],18:[2,46],24:[2,46],26:[2,46],28:[2,46],31:[2,46],32:[2,46],33:[2,46],34:[2,46],35:[2,46],36:[2,46],40:[2,46],41:[2,46],42:[2,46],45:[2,46],47:[2,46],48:[2,46],49:[2,46],50:[2,46]},{6:[2,9],14:[2,9],16:[2,9],18:[1,49],26:[2,9]},{6:[2,11],14:[2,11],16:[2,11],18:[2,11],26:[2,11]},{6:[2,10],14:[2,10],16:[2,10],18:[1,50],26:[2,10]},{6:[2,13],14:[2,13],16:[2,13],18:[2,13],26:[2,13]},{6:[1,54],8:51,9:[1,53],19:52,20:36,21:[1,37],31:[2,21],35:[2,21],36:[2,21],40:[2,21],41:[2,21],42:[2,21],45:[2,21],47:[2,21],48:[2,21],50:[2,21]},{6:[2,17],9:[2,17],21:[2,17],31:[2,17],35:[2,17],36:[2,17],40:[2,17],41:[2,17],42:[2,17],45:[2,17],47:[2,17],48:[2,17],50:[2,17]},{13:55,27:13,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{18:[1,58],22:56,24:[1,57]},{27:59,29:14,30:15,31:[1,16],35:[1,17],36:[1,18],37:19,39:20,40:[1,21],41:[1,22],42:[1,23],43:24,44:25,45:[1,26],47:[1,27],48:[1,29],50:[1,28]},{6:[2,28],14:[2,28],16:[2,28],18:[2,28],24:[1,41],26:[2,28],28:[2,28],31:[2,28],32:[2,28],33:[1,40],34:[1,42],35:[2,28],36:[2,28],38:43,40:[2,28],41:[2,28],42:[2,28],45:[2,28],47:[2,28],48:[2,28],49:[1,44],50:[2,28]},{6:[2,31],14:[2,31],16:[2,31],18:[2,31],24:[2,31],26:[2,31],28:[2,31],31:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],41:[2,31],42:[2,31],45:[2,31],47:[2,31],48:[2,31],49:[2,31],50:[2,31]},{6:[2,32],14:[2,32],16:[2,32],18:[2,32],24:[2,32],26:[2,32],28:[2,32],31:[2,32],32:[2,32],33:[2,32],34:[2,32],35:[2,32],36:[2,32],40:[2,32],41:[2,32],42:[2,32],45:[2,32],47:[2,32],48:[2,32],49:[2,32],50:[2,32]},{6:[2,33],14:[2,33],16:[2,33],18:[2,33],24:[2,33],26:[2,33],28:[2,33],31:[2,33],32:[2,33],33:[2,33],34:[2,33],35:[2,33],36:[2,33],40:[2,33],41:[2,33],42:[2,33],45:[2,33],47:[2,33],48:[2,33],49:[2,33],50:[2,33]},{6:[2,37],14:[2,37],16:[2,37],18:[2,37],24:[2,37],26:[2,37],28:[2,37],31:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],41:[2,37],42:[2,37],45:[2,37],47:[2,37],48:[2,37],49:[2,37],50:[2,37]},{6:[2,47],14:[2,47],16:[2,47],18:[2,47],24:[2,47],26:[2,47],28:[2,47],31:[2,47],32:[2,47],33:[2,47],34:[2,47],35:[2,47],36:[2,47],40:[2,47],41:[2,47],42:[2,47],45:[2,47],47:[2,47],48:[2,47],49:[2,47],50:[2,47]},{28:[1,38],32:[1,60]},{6:[2,34],14:[2,34],16:[2,34],18:[2,34],24:[1,41],26:[2,34],28:[2,34],31:[2,34],32:[2,34],33:[1,40],34:[1,42],35:[2,34],36:[2,34],38:43,40:[2,34],41:[2,34],42:[2,34],45:[2,34],47:[2,34],48:[2,34],49:[1,44],50:[2,34]},{6:[2,35],14:[2,35],16:[2,35],18:[2,35],24:[1,41],26:[2,35],28:[2,35],31:[2,35],32:[2,35],33:[1,40],34:[1,42],35:[2,35],36:[2,35],38:43,40:[2,35],41:[2,35],42:[2,35],45:[2,35],47:[2,35],48:[2,35],49:[1,44],50:[2,35]},{46:[1,61]},{6:[2,12],14:[2,12],16:[2,12],18:[2,12],26:[2,12]},{6:[2,14],14:[2,14],16:[2,14],18:[2,14],26:[2,14]},{1:[2,1]},{6:[2,16],9:[2,16],21:[2,16],31:[2,16],35:[2,16],36:[2,16],40:[2,16],41:[2,16],42:[2,16],45:[2,16],47:[2,16],48:[2,16],50:[2,16]},{1:[2,2]},{9:[1,62]},{10:63,26:[1,9]},{23:[1,64],25:[1,65]},{23:[1,66]},{23:[2,22],25:[2,22]},{6:[2,26],14:[2,26],16:[2,26],18:[2,26],26:[2,26],28:[1,38],32:[2,26]},{6:[2,30],14:[2,30],16:[2,30],18:[2,30],24:[2,30],26:[2,30],28:[2,30],31:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],41:[2,30],42:[2,30],45:[2,30],47:[2,30],48:[2,30],49:[2,30],50:[2,30]},{6:[2,44],14:[2,44],16:[2,44],18:[2,44],24:[2,44],26:[2,44],28:[2,44],31:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],41:[2,44],42:[2,44],45:[2,44],47:[2,44],48:[2,44],49:[2,44],50:[2,44]},{1:[2,3]},{6:[2,18],9:[2,18],21:[2,18],31:[2,18],35:[2,18],36:[2,18],40:[2,18],41:[2,18],42:[2,18],45:[2,18],47:[2,18],48:[2,18],50:[2,18]},{31:[2,19],35:[2,19],36:[2,19],40:[2,19],41:[2,19],42:[2,19],45:[2,19],47:[2,19],48:[2,19],50:[2,19]},{18:[1,67]},{31:[2,20],35:[2,20],36:[2,20],40:[2,20],41:[2,20],42:[2,20],45:[2,20],47:[2,20],48:[2,20],50:[2,20]},{23:[2,23],25:[2,23]}],
-defaultActions: {5:[2,4],51:[2,1],53:[2,2],62:[2,3]},
+table: [{3:1,4:2,6:[2,7],14:[2,7],16:[2,7],18:[2,7],26:[2,7]},{1:[3]},{5:3,6:[2,5],10:5,11:4,12:6,14:[1,7],16:[1,8],18:[1,10],26:[1,9]},{6:[1,11]},{6:[2,6],14:[2,6],16:[2,6],18:[2,6],26:[2,6]},{6:[2,4]},{13:12,27:13,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:[2,24],9:[2,24],21:[2,24],31:[2,24],33:[2,24],36:[2,24],37:[2,24],41:[2,24],42:[2,24],43:[2,24],46:[2,24],48:[2,24],49:[2,24],51:[2,24]},{31:[2,15],33:[2,15],36:[2,15],37:[2,15],41:[2,15],42:[2,15],43:[2,15],46:[2,15],47:[2,15],48:[2,15],49:[2,15],51:[2,15]},{7:35,19:36,20:37,21:[1,38],31:[2,21],33:[2,21],36:[2,21],37:[2,21],41:[2,21],42:[2,21],43:[2,21],46:[2,21],48:[2,21],49:[2,21],51:[2,21]},{6:[2,8],14:[2,8],16:[2,8],18:[2,8],26:[2,8]},{6:[2,25],14:[2,25],16:[2,25],18:[2,25],26:[2,25],28:[1,39]},{6:[2,27],14:[2,27],16:[2,27],18:[2,27],26:[2,27],28:[2,27],30:40,31:[1,16],32:[2,27],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{6:[2,29],14:[2,29],16:[2,29],18:[2,29],24:[1,42],26:[2,29],28:[2,29],31:[2,29],32:[2,29],33:[2,29],34:[1,41],35:[1,43],36:[2,29],37:[2,29],39:44,41:[2,29],42:[2,29],43:[2,29],46:[2,29],48:[2,29],49:[2,29],50:[1,45],51:[2,29]},{27:46,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{27:47,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{30:48,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{30:49,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{6:[2,37],14:[2,37],16:[2,37],18:[2,37],24:[2,37],26:[2,37],28:[2,37],31:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],37:[2,37],41:[2,37],42:[2,37],43:[2,37],46:[2,37],48:[2,37],49:[2,37],50:[2,37],51:[2,37]},{6:[2,39],14:[2,39],16:[2,39],18:[2,39],24:[2,39],26:[2,39],28:[2,39],31:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],37:[2,39],41:[2,39],42:[2,39],43:[2,39],46:[2,39],48:[2,39],49:[2,39],50:[2,39],51:[2,39]},{6:[2,40],14:[2,40],16:[2,40],18:[2,40],24:[2,40],26:[2,40],28:[2,40],31:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],37:[2,40],41:[2,40],42:[2,40],43:[2,40],46:[2,40],48:[2,40],49:[2,40],50:[2,40],51:[2,40]},{6:[2,41],14:[2,41],16:[2,41],18:[2,41],24:[2,41],26:[2,41],28:[2,41],31:[2,41],32:[2,41],33:[2,41],34:[2,41],35:[2,41],36:[2,41],37:[2,41],41:[2,41],42:[2,41],43:[2,41],46:[2,41],48:[2,41],49:[2,41],50:[2,41],51:[2,41]},{6:[2,42],14:[2,42],16:[2,42],18:[2,42],24:[2,42],26:[2,42],28:[2,42],31:[2,42],32:[2,42],33:[2,42],34:[2,42],35:[2,42],36:[2,42],37:[2,42],41:[2,42],42:[2,42],43:[2,42],46:[2,42],48:[2,42],49:[2,42],50:[2,42],51:[2,42]},{6:[2,43],14:[2,43],16:[2,43],18:[2,43],24:[2,43],26:[2,43],28:[2,43],31:[2,43],32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],37:[2,43],41:[2,43],42:[2,43],43:[2,43],46:[2,43],48:[2,43],49:[2,43],50:[2,43],51:[2,43]},{6:[2,44],14:[2,44],16:[2,44],18:[2,44],24:[2,44],26:[2,44],28:[2,44],31:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],37:[2,44],41:[2,44],42:[2,44],43:[2,44],46:[2,44],48:[2,44],49:[2,44],50:[2,44],51:[2,44]},{12:50,18:[1,10]},{6:[2,46],14:[2,46],16:[2,46],18:[2,46],24:[2,46],26:[2,46],28:[2,46],31:[2,46],32:[2,46],33:[2,46],34:[2,46],35:[2,46],36:[2,46],37:[2,46],41:[2,46],42:[2,46],43:[2,46],46:[2,46],48:[2,46],49:[2,46],50:[2,46],51:[2,46]},{6:[2,49],14:[2,49],16:[2,49],18:[2,49],24:[2,49],26:[2,49],28:[2,49],31:[2,49],32:[2,49],33:[2,49],34:[2,49],35:[2,49],36:[2,49],37:[2,49],41:[2,49],42:[2,49],43:[2,49],46:[2,49],48:[2,49],49:[2,49],50:[2,49],51:[2,49]},{6:[2,47],14:[2,47],16:[2,47],18:[2,47],24:[2,47],26:[2,47],28:[2,47],31:[2,47],32:[2,47],33:[2,47],34:[2,47],35:[2,47],36:[2,47],37:[2,47],41:[2,47],42:[2,47],43:[2,47],46:[2,47],48:[2,47],49:[2,47],50:[2,47],51:[2,47]},{6:[2,9],14:[2,9],16:[2,9],18:[1,51],26:[2,9]},{6:[2,11],14:[2,11],16:[2,11],18:[2,11],26:[2,11]},{6:[2,10],14:[2,10],16:[2,10],18:[1,52],26:[2,10]},{6:[2,13],14:[2,13],16:[2,13],18:[2,13],26:[2,13]},{6:[1,56],8:53,9:[1,55],19:54,20:37,21:[1,38],31:[2,21],33:[2,21],36:[2,21],37:[2,21],41:[2,21],42:[2,21],43:[2,21],46:[2,21],48:[2,21],49:[2,21],51:[2,21]},{6:[2,17],9:[2,17],21:[2,17],31:[2,17],33:[2,17],36:[2,17],37:[2,17],41:[2,17],42:[2,17],43:[2,17],46:[2,17],48:[2,17],49:[2,17],51:[2,17]},{13:57,27:13,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{18:[1,60],22:58,24:[1,59]},{27:61,29:14,30:15,31:[1,16],33:[1,17],36:[1,18],37:[1,19],38:20,40:21,41:[1,22],42:[1,23],43:[1,24],44:25,45:26,46:[1,27],48:[1,28],49:[1,30],51:[1,29]},{6:[2,28],14:[2,28],16:[2,28],18:[2,28],24:[1,42],26:[2,28],28:[2,28],31:[2,28],32:[2,28],33:[2,28],34:[1,41],35:[1,43],36:[2,28],37:[2,28],39:44,41:[2,28],42:[2,28],43:[2,28],46:[2,28],48:[2,28],49:[2,28],50:[1,45],51:[2,28]},{6:[2,32],14:[2,32],16:[2,32],18:[2,32],24:[2,32],26:[2,32],28:[2,32],31:[2,32],32:[2,32],33:[2,32],34:[2,32],35:[2,32],36:[2,32],37:[2,32],41:[2,32],42:[2,32],43:[2,32],46:[2,32],48:[2,32],49:[2,32],50:[2,32],51:[2,32]},{6:[2,33],14:[2,33],16:[2,33],18:[2,33],24:[2,33],26:[2,33],28:[2,33],31:[2,33],32:[2,33],33:[2,33],34:[2,33],35:[2,33],36:[2,33],37:[2,33],41:[2,33],42:[2,33],43:[2,33],46:[2,33],48:[2,33],49:[2,33],50:[2,33],51:[2,33]},{6:[2,34],14:[2,34],16:[2,34],18:[2,34],24:[2,34],26:[2,34],28:[2,34],31:[2,34],32:[2,34],33:[2,34],34:[2,34],35:[2,34],36:[2,34],37:[2,34],41:[2,34],42:[2,34],43:[2,34],46:[2,34],48:[2,34],49:[2,34],50:[2,34],51:[2,34]},{6:[2,38],14:[2,38],16:[2,38],18:[2,38],24:[2,38],26:[2,38],28:[2,38],31:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],37:[2,38],41:[2,38],42:[2,38],43:[2,38],46:[2,38],48:[2,38],49:[2,38],50:[2,38],51:[2,38]},{6:[2,48],14:[2,48],16:[2,48],18:[2,48],24:[2,48],26:[2,48],28:[2,48],31:[2,48],32:[2,48],33:[2,48],34:[2,48],35:[2,48],36:[2,48],37:[2,48],41:[2,48],42:[2,48],43:[2,48],46:[2,48],48:[2,48],49:[2,48],50:[2,48],51:[2,48]},{28:[1,39],32:[1,62]},{28:[1,39],32:[1,63]},{6:[2,35],14:[2,35],16:[2,35],18:[2,35],24:[1,42],26:[2,35],28:[2,35],31:[2,35],32:[2,35],33:[2,35],34:[1,41],35:[1,43],36:[2,35],37:[2,35],39:44,41:[2,35],42:[2,35],43:[2,35],46:[2,35],48:[2,35],49:[2,35],50:[1,45],51:[2,35]},{6:[2,36],14:[2,36],16:[2,36],18:[2,36],24:[1,42],26:[2,36],28:[2,36],31:[2,36],32:[2,36],33:[2,36],34:[1,41],35:[1,43],36:[2,36],37:[2,36],39:44,41:[2,36],42:[2,36],43:[2,36],46:[2,36],48:[2,36],49:[2,36],50:[1,45],51:[2,36]},{47:[1,64]},{6:[2,12],14:[2,12],16:[2,12],18:[2,12],26:[2,12]},{6:[2,14],14:[2,14],16:[2,14],18:[2,14],26:[2,14]},{1:[2,1]},{6:[2,16],9:[2,16],21:[2,16],31:[2,16],33:[2,16],36:[2,16],37:[2,16],41:[2,16],42:[2,16],43:[2,16],46:[2,16],48:[2,16],49:[2,16],51:[2,16]},{1:[2,2]},{9:[1,65]},{10:66,26:[1,9]},{23:[1,67],25:[1,68]},{23:[1,69]},{23:[2,22],25:[2,22]},{6:[2,26],14:[2,26],16:[2,26],18:[2,26],26:[2,26],28:[1,39],32:[2,26]},{6:[2,30],14:[2,30],16:[2,30],18:[2,30],24:[2,30],26:[2,30],28:[2,30],31:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],37:[2,30],41:[2,30],42:[2,30],43:[2,30],46:[2,30],48:[2,30],49:[2,30],50:[2,30],51:[2,30]},{6:[2,31],14:[2,31],16:[2,31],18:[2,31],24:[2,31],26:[2,31],28:[2,31],31:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],37:[2,31],41:[2,31],42:[2,31],43:[2,31],46:[2,31],48:[2,31],49:[2,31],50:[2,31],51:[2,31]},{6:[2,45],14:[2,45],16:[2,45],18:[2,45],24:[2,45],26:[2,45],28:[2,45],31:[2,45],32:[2,45],33:[2,45],34:[2,45],35:[2,45],36:[2,45],37:[2,45],41:[2,45],42:[2,45],43:[2,45],46:[2,45],48:[2,45],49:[2,45],50:[2,45],51:[2,45]},{1:[2,3]},{6:[2,18],9:[2,18],21:[2,18],31:[2,18],33:[2,18],36:[2,18],37:[2,18],41:[2,18],42:[2,18],43:[2,18],46:[2,18],48:[2,18],49:[2,18],51:[2,18]},{31:[2,19],33:[2,19],36:[2,19],37:[2,19],41:[2,19],42:[2,19],43:[2,19],46:[2,19],48:[2,19],49:[2,19],51:[2,19]},{18:[1,70]},{31:[2,20],33:[2,20],36:[2,20],37:[2,20],41:[2,20],42:[2,20],43:[2,20],46:[2,20],48:[2,20],49:[2,20],51:[2,20]},{23:[2,23],25:[2,23]}],
+defaultActions: {5:[2,4],53:[2,1],55:[2,2],65:[2,3]},
parseError: function parseError(str, hash) {
throw new Error(str);
},
@@ -2687,6 +2719,8 @@ parse: function parse(input) {
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
+ if (typeof this.lexer.yylloc == 'undefined')
+ this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
@@ -2771,7 +2805,7 @@ parse: function parse(input) {
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];
@@ -2819,7 +2853,7 @@ parse: function parse(input) {
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,
+ last_column: lstack[lstack.length-1].last_column
};
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
@@ -2925,7 +2959,7 @@ next:function () {
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-1 : this.yylloc.last_column + match.length}
+ last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
this.yytext += match[0];
this.match += match[0];
this.matches = match;
@@ -2980,64 +3014,72 @@ case 5:if (yy.ruleSection) this.begin('indented')
break;
case 6:return 18
break;
-case 7:yy_.yytext = yy_.yytext.replace(/\\"/g,'"');return 50;
+case 7:yy_.yytext = yy_.yytext.replace(/\\"/g,'"');return 51;
break;
-case 8:yy_.yytext = yy_.yytext.replace(/\\'/g,"'");return 50;
+case 8:yy_.yytext = yy_.yytext.replace(/\\'/g,"'");return 51;
break;
case 9:return 28
break;
-case 10:return 47
+case 10:return 48
break;
-case 11:return 31
+case 11:return 33
break;
-case 12:return 32
+case 12:return 33
break;
case 13:return 33
break;
-case 14:return 24
+case 14:return 31
+break;
+case 15:return 32
+break;
+case 16:return 34
+break;
+case 17:return 24
+break;
+case 18:return 35
break;
-case 15:return 34
+case 19:return 42
break;
-case 16:return 41
+case 20:return 25
break;
-case 17:return 25
+case 21:return 43
break;
-case 18:return 42
+case 22:return 21
break;
-case 19:return 21
+case 23:return 23
break;
-case 20:return 23
+case 24:return 37
break;
-case 21:return 36
+case 25:return 36
break;
-case 22:return 35
+case 26:return 49
break;
-case 23:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 48
+case 27:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 49
break;
-case 24:return 42
+case 28:return 43
break;
-case 25:return 40
+case 29:return 41
break;
-case 26:return 14
+case 30:return 14
break;
-case 27:return 16
+case 31:return 16
break;
-case 28:yy.ruleSection = true; return 6
+case 32:yy.ruleSection = true; return 6
break;
-case 29:return 49
+case 33:return 50
break;
-case 30:return 45
+case 34:return 46
break;
-case 31:return 46
+case 35:return 47
break;
-case 32:/* ignore bad characters */
+case 36:/* ignore bad characters */
break;
-case 33:return 9
+case 37:return 9
break;
}
};
-lexer.rules = [/^.*\n+/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^.+/,/^\n+/,/^\s+/,/^[a-zA-Z_][a-zA-Z0-9_-]*/,/^"(\\\\|\\"|[^"])*"/,/^'(\\\\|\\'|[^'])*'/,/^\|/,/^\[(\\\]|[^\]])*\]/,/^\(/,/^\)/,/^\+/,/^\*/,/^\?/,/^\^/,/^,/,/^<<EOF>>/,/^</,/^>/,/^\/!/,/^\//,/^\\[a-zA-Z0"]/,/^\$/,/^\./,/^%s\b/,/^%x\b/,/^%%/,/^\{\d+(,\s?\d+|,)?\}/,/^\{/,/^\}/,/^./,/^$/];
-lexer.conditions = {"indented":{"rules":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true},"trail":{"rules":[0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true},"INITIAL":{"rules":[2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true}};return lexer;})()
+lexer.rules = [/^.*\n+/,/^\{[^}]*\}/,/^%\{(.|\n)*?%\}/,/^.+/,/^\n+/,/^\s+/,/^[a-zA-Z_][a-zA-Z0-9_-]*/,/^"(\\\\|\\"|[^"])*"/,/^'(\\\\|\\'|[^'])*'/,/^\|/,/^\[(\\\]|[^\]])*\]/,/^\(\?:/,/^\(\?=/,/^\(\?!/,/^\(/,/^\)/,/^\+/,/^\*/,/^\?/,/^\^/,/^,/,/^<<EOF>>/,/^</,/^>/,/^\/!/,/^\//,/^\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4})/,/^\\./,/^\$/,/^\./,/^%s\b/,/^%x\b/,/^%%/,/^\{\d+(,\s?\d+|,)?\}/,/^\{/,/^\}/,/^./,/^$/];
+lexer.conditions = {"indented":{"rules":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true},"trail":{"rules":[0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true},"INITIAL":{"rules":[2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true}};return lexer;})()
parser.lexer = lexer;
return parser;
})();
View
3  web/content/assets/js/usf.js
@@ -9,6 +9,9 @@ var printOut = function(str){document.getElementById("out").value = JSON.stringi
$(function () {
+ Jison = require('jison');
+ bnf = require('jison/bnf');
+
$("#process_btn").click(processGrammar);
$("#parse_btn").click(runParser);
View
1  web/content/assets/styles/usf.css
@@ -31,6 +31,7 @@ a img { border: 0px; }
#nonterminals dl {
font-size: 90%;
}
+#parsing { display: none; }
dt { font-weight: bold; }
View
18 web/content/docs.html
@@ -24,15 +24,11 @@
Installation
------------
-Jison can be installed for [Narwhal](http://github.com/280north/narwhal) using its bundled `tusk` command or for [Node](http://nodejs.org) using [`npm`](http://github.com/isaacs/npm/)
+Jison can be installed for [Node](http://nodejs.org) using [`npm`](http://github.com/isaacs/npm/)
Using npm:
- npm install jison
-
-Using tusk:
-
- tusk install jison
+ npm install jison -g
Usage from the command line
-----------------------
@@ -296,7 +292,7 @@
----------------
Jison includes a rather rudimentary scanner generator, though **any module that supports the basic scanner API could be used** in its place.
-The format of the [input file](http://dinosaur.compilertools.net/flex/flex_6.html#SEC6) (including macro support) and the style of the [pattern matchers](http://dinosaur.compilertools.net/flex/flex_7.html#SEC7) are modeled after Flex. It is a subset, so there are some differences, namely exact string patterns must be placed in quotes e.g.:
+The format of the [input file](http://dinosaur.compilertools.net/flex/flex_6.html#SEC6) (including macro support) and the style of the [pattern matchers](http://dinosaur.compilertools.net/flex/flex_7.html#SEC7) are modeled after Flex. Several [metacharacters have been added](https://github.com/zaach/jison/wiki/DeviationsFromBison), but there is also one minor inconvenience compared to Flex patterns, namely exact string patterns must be placed in quotes e.g.:
Bad:
@@ -385,13 +381,7 @@
Projects using Jison
------------------
-
-* [CoffeeScript](http://github.com/jashkenas/coffee-script)
-* [handlebars.js](https://github.com/wycats/handlebars.js)
-* [jQuery.sheet](http://visop-dev.com/Project+jQuery.sheet)
-* [cafe](http://github.com/zaach/cafe)
-* [jsonlint](http://github.com/zaach/jsonlint)
-* [Orderly.js](http://github.com/zaach/orderly.js)
+View them on the [wiki](https://github.com/zaach/jison/wiki/ProjectsUsingJison), or add your own.
Contributors
------------
View
9 web/content/try/usf.html
@@ -86,14 +86,7 @@
<script src="/jison/assets/js/jquery.js"></script>
<script src="/jison/assets/js/json2.js"></script>
<script src="/jison/assets/js/es5.js"></script>
- <script src="/jison/assets/js/lib/jison/lexer.js"></script>
- <script src="/jison/assets/js/lib/jison/util/typal.js"></script>
- <script src="/jison/assets/js/lib/jison/util/set.js"></script>
- <script src="/jison/assets/js/lib/jison/util/bnf-parser.js"></script>
- <script src="/jison/assets/js/lib/jison/util/lex-parser.js"></script>
- <script src="/jison/assets/js/lib/jison/bnf.js"></script>
- <script src="/jison/assets/js/lib/jison/jisonlex.js"></script>
- <script src="/jison/assets/js/lib/jison.js"></script>
+ <script src="/jison/assets/js/jison.js"></script>
<script src="/jison/assets/js/usf.js"></script>
</body>
</head>
Please sign in to comment.
Something went wrong with that request. Please try again.