slash_admin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +95 -0
- data/app/assets/config/relax_admin_manifest.js +2 -0
- data/app/assets/images/slash_admin/en.png +0 -0
- data/app/assets/images/slash_admin/favicon.png +0 -0
- data/app/assets/images/slash_admin/fr.png +0 -0
- data/app/assets/javascripts/slash_admin/application.js +344 -0
- data/app/assets/javascripts/slash_admin/custom.js +0 -0
- data/app/assets/stylesheets/slash_admin/alert.scss +29 -0
- data/app/assets/stylesheets/slash_admin/application.scss +1469 -0
- data/app/assets/stylesheets/slash_admin/colors.scss +17 -0
- data/app/assets/stylesheets/slash_admin/custom.scss +0 -0
- data/app/controllers/slash_admin/application_controller.rb +17 -0
- data/app/controllers/slash_admin/base_controller.rb +45 -0
- data/app/controllers/slash_admin/batch_actions_controller.rb +17 -0
- data/app/controllers/slash_admin/dashboard_controller.rb +11 -0
- data/app/controllers/slash_admin/models_controller.rb +325 -0
- data/app/controllers/slash_admin/security/sessions_controller.rb +29 -0
- data/app/controllers/slash_admin/selectize_controller.rb +49 -0
- data/app/helpers/slash_admin/application_helper.rb +212 -0
- data/app/helpers/slash_admin/menu_helper.rb +14 -0
- data/app/helpers/slash_admin/widgets_helper.rb +7 -0
- data/app/jobs/slash_admin/application_job.rb +4 -0
- data/app/mailers/slash_admin/application_mailer.rb +6 -0
- data/app/models/slash_admin/admin.rb +46 -0
- data/app/models/slash_admin/admin_ability.rb +11 -0
- data/app/models/slash_admin/application_record.rb +5 -0
- data/app/views/layouts/slash_admin/admin_user.html.erb +16 -0
- data/app/views/layouts/slash_admin/application.html.erb +40 -0
- data/app/views/slash_admin/base/_data_belongs_to.html.erb +37 -0
- data/app/views/slash_admin/base/_data_list.html.erb +276 -0
- data/app/views/slash_admin/base/_data_nestable.html.erb +33 -0
- data/app/views/slash_admin/base/_data_new.html.erb +16 -0
- data/app/views/slash_admin/base/_data_show.html.erb +72 -0
- data/app/views/slash_admin/base/_filters.html.erb +60 -0
- data/app/views/slash_admin/base/_translatable_fields.html.erb +23 -0
- data/app/views/slash_admin/base/edit.html.erb +26 -0
- data/app/views/slash_admin/base/index.html.erb +47 -0
- data/app/views/slash_admin/base/index.xls.erb +27 -0
- data/app/views/slash_admin/base/nestable.html.erb +28 -0
- data/app/views/slash_admin/base/new.html.erb +26 -0
- data/app/views/slash_admin/base/show.html.erb +22 -0
- data/app/views/slash_admin/custom_fields/_color.html.erb +2 -0
- data/app/views/slash_admin/custom_fields/_email.html.erb +2 -0
- data/app/views/slash_admin/custom_fields/_google_map.html.erb +72 -0
- data/app/views/slash_admin/custom_fields/_nested_belongs_to.html.erb +55 -0
- data/app/views/slash_admin/custom_fields/_password.html.erb +2 -0
- data/app/views/slash_admin/custom_fields/_select.html.erb +2 -0
- data/app/views/slash_admin/custom_fields/_tags.html.erb +2 -0
- data/app/views/slash_admin/custom_fields/_wysiwyg.html.erb +2 -0
- data/app/views/slash_admin/dashboard/home.html.erb +5 -0
- data/app/views/slash_admin/dashboard/widgets/_statistic_chart.html.erb +0 -0
- data/app/views/slash_admin/dashboard/widgets/_statistic_progress_tile.html.erb +29 -0
- data/app/views/slash_admin/fields/_belongs_to.html.erb +9 -0
- data/app/views/slash_admin/fields/_boolean.html.erb +2 -0
- data/app/views/slash_admin/fields/_carrierwave.html.erb +15 -0
- data/app/views/slash_admin/fields/_date.html.erb +2 -0
- data/app/views/slash_admin/fields/_decimal.html.erb +2 -0
- data/app/views/slash_admin/fields/_form_group.html.erb +12 -0
- data/app/views/slash_admin/fields/_has_many.html.erb +12 -0
- data/app/views/slash_admin/fields/_has_many_row.html.erb +18 -0
- data/app/views/slash_admin/fields/_has_one.html.erb +24 -0
- data/app/views/slash_admin/fields/_integer.html.erb +2 -0
- data/app/views/slash_admin/fields/_json.html.erb +14 -0
- data/app/views/slash_admin/fields/_nested_has_many.html.erb +14 -0
- data/app/views/slash_admin/fields/_number.html.erb +2 -0
- data/app/views/slash_admin/fields/_string.html.erb +2 -0
- data/app/views/slash_admin/fields/_text.html.erb +2 -0
- data/app/views/slash_admin/security/sessions/new.html.erb +30 -0
- data/app/views/slash_admin/shared/_batch_actions.html.erb +21 -0
- data/app/views/slash_admin/shared/_better_paginate.html.erb +30 -0
- data/app/views/slash_admin/shared/_breadcrumb.html.erb +30 -0
- data/app/views/slash_admin/shared/_debug.html.erb +24 -0
- data/app/views/slash_admin/shared/_errors_data_new.html.erb +12 -0
- data/app/views/slash_admin/shared/_header.html.erb +38 -0
- data/app/views/slash_admin/shared/_menu.html.erb +57 -0
- data/app/views/slash_admin/shared/_new_form_buttons.html.erb +9 -0
- data/app/views/slash_admin/shared/_sub_header.html.erb +11 -0
- data/config/initializers/validators.rb +13 -0
- data/config/locales/slash_admin.en.yml +67 -0
- data/config/locales/slash_admin.fr.yml +72 -0
- data/config/routes.rb +16 -0
- data/db/migrate/20170512104248_create_slash_admin_admins.rb +19 -0
- data/lib/batch_translation.rb +19 -0
- data/lib/generators/slash_admin/controllers/controllers_generator.rb +16 -0
- data/lib/generators/slash_admin/controllers/templates/controllers.erb +9 -0
- data/lib/generators/slash_admin/install/install_generator.rb +13 -0
- data/lib/generators/slash_admin/install/templates/install.erb +14 -0
- data/lib/generators/slash_admin/override_admin/override_admin_generator.rb +13 -0
- data/lib/generators/slash_admin/override_admin/templates/admin.erb +46 -0
- data/lib/generators/slash_admin/override_session/override_session_generator.rb +13 -0
- data/lib/generators/slash_admin/override_session/templates/session.erb +27 -0
- data/lib/generators/slash_admin/permissions/permissions_generator.rb +13 -0
- data/lib/generators/slash_admin/permissions/templates/permissions.erb +11 -0
- data/lib/slash_admin.rb +29 -0
- data/lib/slash_admin/engine.rb +8 -0
- data/lib/slash_admin/version.rb +3 -0
- data/lib/tasks/slash_admin_tasks.rake +4 -0
- data/vendor/assets/javascripts/bootstrap-material-datetimepicker.js +1295 -0
- data/vendor/assets/javascripts/codemirror/codemirror.js +9657 -0
- data/vendor/assets/javascripts/codemirror/lint/json-lint.js +37 -0
- data/vendor/assets/javascripts/codemirror/lint/jsonlint.js +432 -0
- data/vendor/assets/javascripts/codemirror/lint/lint.js +252 -0
- data/vendor/assets/javascripts/codemirror/mode/javascript.js +865 -0
- data/vendor/assets/javascripts/jquery.nestable.js +910 -0
- data/vendor/assets/javascripts/jquery.tagsinput-revisited.min.js +5 -0
- data/vendor/assets/javascripts/toastr.js +6 -0
- data/vendor/assets/stylesheets/animate.css +1579 -0
- data/vendor/assets/stylesheets/bootstrap-material-datetimepicker.css +82 -0
- data/vendor/assets/stylesheets/codemirror/codemirror.css +346 -0
- data/vendor/assets/stylesheets/codemirror/lint/lint.css +73 -0
- data/vendor/assets/stylesheets/codemirror/theme/relax-seti.css +41 -0
- data/vendor/assets/stylesheets/jquery.nestable.css +121 -0
- data/vendor/assets/stylesheets/jquery.tagsinput-revisited.min.css +1 -0
- data/vendor/assets/stylesheets/sweetalert.css +935 -0
- data/vendor/assets/stylesheets/toastr.css +1 -0
- metadata +509 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
3
|
+
|
|
4
|
+
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
|
|
5
|
+
|
|
6
|
+
// declare global: jsonlint
|
|
7
|
+
|
|
8
|
+
(function(mod) {
|
|
9
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
10
|
+
mod(require("../../lib/codemirror"));
|
|
11
|
+
else if (typeof define == "function" && define.amd) // AMD
|
|
12
|
+
define(["../../lib/codemirror"], mod);
|
|
13
|
+
else // Plain browser env
|
|
14
|
+
mod(CodeMirror);
|
|
15
|
+
})(function(CodeMirror) {
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
CodeMirror.registerHelper("lint", "json", function(text) {
|
|
19
|
+
var found = [];
|
|
20
|
+
if (!window.jsonlint) {
|
|
21
|
+
if (window.console) {
|
|
22
|
+
window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run.");
|
|
23
|
+
}
|
|
24
|
+
return found;
|
|
25
|
+
}
|
|
26
|
+
jsonlint.parseError = function(str, hash) {
|
|
27
|
+
var loc = hash.loc;
|
|
28
|
+
found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
|
|
29
|
+
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
|
|
30
|
+
message: str});
|
|
31
|
+
};
|
|
32
|
+
try { jsonlint.parse(text); }
|
|
33
|
+
catch(e) {}
|
|
34
|
+
return found;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
});
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
/* Jison generated parser */
|
|
2
|
+
var jsonlint = (function(){
|
|
3
|
+
var parser = {trace: function trace() { },
|
|
4
|
+
yy: {},
|
|
5
|
+
symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1},
|
|
6
|
+
terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
|
|
7
|
+
productions_: [0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],
|
|
8
|
+
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
|
9
|
+
|
|
10
|
+
var $0 = $$.length - 1;
|
|
11
|
+
switch (yystate) {
|
|
12
|
+
case 1: // replace escaped characters with actual character
|
|
13
|
+
this.$ = yytext.replace(/\\(\\|")/g, "$"+"1")
|
|
14
|
+
.replace(/\\n/g,'\n')
|
|
15
|
+
.replace(/\\r/g,'\r')
|
|
16
|
+
.replace(/\\t/g,'\t')
|
|
17
|
+
.replace(/\\v/g,'\v')
|
|
18
|
+
.replace(/\\f/g,'\f')
|
|
19
|
+
.replace(/\\b/g,'\b');
|
|
20
|
+
|
|
21
|
+
break;
|
|
22
|
+
case 2:this.$ = Number(yytext);
|
|
23
|
+
break;
|
|
24
|
+
case 3:this.$ = null;
|
|
25
|
+
break;
|
|
26
|
+
case 4:this.$ = true;
|
|
27
|
+
break;
|
|
28
|
+
case 5:this.$ = false;
|
|
29
|
+
break;
|
|
30
|
+
case 6:return this.$ = $$[$0-1];
|
|
31
|
+
break;
|
|
32
|
+
case 13:this.$ = {};
|
|
33
|
+
break;
|
|
34
|
+
case 14:this.$ = $$[$0-1];
|
|
35
|
+
break;
|
|
36
|
+
case 15:this.$ = [$$[$0-2], $$[$0]];
|
|
37
|
+
break;
|
|
38
|
+
case 16:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1];
|
|
39
|
+
break;
|
|
40
|
+
case 17:this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1];
|
|
41
|
+
break;
|
|
42
|
+
case 18:this.$ = [];
|
|
43
|
+
break;
|
|
44
|
+
case 19:this.$ = $$[$0-1];
|
|
45
|
+
break;
|
|
46
|
+
case 20:this.$ = [$$[$0]];
|
|
47
|
+
break;
|
|
48
|
+
case 21:this.$ = $$[$0-2]; $$[$0-2].push($$[$0]);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
table: [{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],
|
|
53
|
+
defaultActions: {16:[2,6]},
|
|
54
|
+
parseError: function parseError(str, hash) {
|
|
55
|
+
throw new Error(str);
|
|
56
|
+
},
|
|
57
|
+
parse: function parse(input) {
|
|
58
|
+
var self = this,
|
|
59
|
+
stack = [0],
|
|
60
|
+
vstack = [null], // semantic value stack
|
|
61
|
+
lstack = [], // location stack
|
|
62
|
+
table = this.table,
|
|
63
|
+
yytext = '',
|
|
64
|
+
yylineno = 0,
|
|
65
|
+
yyleng = 0,
|
|
66
|
+
recovering = 0,
|
|
67
|
+
TERROR = 2,
|
|
68
|
+
EOF = 1;
|
|
69
|
+
|
|
70
|
+
//this.reductionCount = this.shiftCount = 0;
|
|
71
|
+
|
|
72
|
+
this.lexer.setInput(input);
|
|
73
|
+
this.lexer.yy = this.yy;
|
|
74
|
+
this.yy.lexer = this.lexer;
|
|
75
|
+
if (typeof this.lexer.yylloc == 'undefined')
|
|
76
|
+
this.lexer.yylloc = {};
|
|
77
|
+
var yyloc = this.lexer.yylloc;
|
|
78
|
+
lstack.push(yyloc);
|
|
79
|
+
|
|
80
|
+
if (typeof this.yy.parseError === 'function')
|
|
81
|
+
this.parseError = this.yy.parseError;
|
|
82
|
+
|
|
83
|
+
function popStack (n) {
|
|
84
|
+
stack.length = stack.length - 2*n;
|
|
85
|
+
vstack.length = vstack.length - n;
|
|
86
|
+
lstack.length = lstack.length - n;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function lex() {
|
|
90
|
+
var token;
|
|
91
|
+
token = self.lexer.lex() || 1; // $end = 1
|
|
92
|
+
// if token isn't its numeric value, convert
|
|
93
|
+
if (typeof token !== 'number') {
|
|
94
|
+
token = self.symbols_[token] || token;
|
|
95
|
+
}
|
|
96
|
+
return token;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;
|
|
100
|
+
while (true) {
|
|
101
|
+
// retreive state number from top of stack
|
|
102
|
+
state = stack[stack.length-1];
|
|
103
|
+
|
|
104
|
+
// use default actions if available
|
|
105
|
+
if (this.defaultActions[state]) {
|
|
106
|
+
action = this.defaultActions[state];
|
|
107
|
+
} else {
|
|
108
|
+
if (symbol == null)
|
|
109
|
+
symbol = lex();
|
|
110
|
+
// read action for current state and first input
|
|
111
|
+
action = table[state] && table[state][symbol];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// handle parse error
|
|
115
|
+
_handle_error:
|
|
116
|
+
if (typeof action === 'undefined' || !action.length || !action[0]) {
|
|
117
|
+
|
|
118
|
+
if (!recovering) {
|
|
119
|
+
// Report error
|
|
120
|
+
expected = [];
|
|
121
|
+
for (p in table[state]) if (this.terminals_[p] && p > 2) {
|
|
122
|
+
expected.push("'"+this.terminals_[p]+"'");
|
|
123
|
+
}
|
|
124
|
+
var errStr = '';
|
|
125
|
+
if (this.lexer.showPosition) {
|
|
126
|
+
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
|
|
127
|
+
} else {
|
|
128
|
+
errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
|
|
129
|
+
(symbol == 1 /*EOF*/ ? "end of input" :
|
|
130
|
+
("'"+(this.terminals_[symbol] || symbol)+"'"));
|
|
131
|
+
}
|
|
132
|
+
this.parseError(errStr,
|
|
133
|
+
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// just recovered from another error
|
|
137
|
+
if (recovering == 3) {
|
|
138
|
+
if (symbol == EOF) {
|
|
139
|
+
throw new Error(errStr || 'Parsing halted.');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// discard current lookahead and grab another
|
|
143
|
+
yyleng = this.lexer.yyleng;
|
|
144
|
+
yytext = this.lexer.yytext;
|
|
145
|
+
yylineno = this.lexer.yylineno;
|
|
146
|
+
yyloc = this.lexer.yylloc;
|
|
147
|
+
symbol = lex();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// try to recover from error
|
|
151
|
+
while (1) {
|
|
152
|
+
// check for error recovery rule in this state
|
|
153
|
+
if ((TERROR.toString()) in table[state]) {
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (state == 0) {
|
|
157
|
+
throw new Error(errStr || 'Parsing halted.');
|
|
158
|
+
}
|
|
159
|
+
popStack(1);
|
|
160
|
+
state = stack[stack.length-1];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
preErrorSymbol = symbol; // save the lookahead token
|
|
164
|
+
symbol = TERROR; // insert generic error symbol as new lookahead
|
|
165
|
+
state = stack[stack.length-1];
|
|
166
|
+
action = table[state] && table[state][TERROR];
|
|
167
|
+
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// this shouldn't happen, unless resolve defaults are off
|
|
171
|
+
if (action[0] instanceof Array && action.length > 1) {
|
|
172
|
+
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
switch (action[0]) {
|
|
176
|
+
|
|
177
|
+
case 1: // shift
|
|
178
|
+
//this.shiftCount++;
|
|
179
|
+
|
|
180
|
+
stack.push(symbol);
|
|
181
|
+
vstack.push(this.lexer.yytext);
|
|
182
|
+
lstack.push(this.lexer.yylloc);
|
|
183
|
+
stack.push(action[1]); // push state
|
|
184
|
+
symbol = null;
|
|
185
|
+
if (!preErrorSymbol) { // normal execution/no error
|
|
186
|
+
yyleng = this.lexer.yyleng;
|
|
187
|
+
yytext = this.lexer.yytext;
|
|
188
|
+
yylineno = this.lexer.yylineno;
|
|
189
|
+
yyloc = this.lexer.yylloc;
|
|
190
|
+
if (recovering > 0)
|
|
191
|
+
recovering--;
|
|
192
|
+
} else { // error just occurred, resume old lookahead f/ before error
|
|
193
|
+
symbol = preErrorSymbol;
|
|
194
|
+
preErrorSymbol = null;
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
|
|
198
|
+
case 2: // reduce
|
|
199
|
+
//this.reductionCount++;
|
|
200
|
+
|
|
201
|
+
len = this.productions_[action[1]][1];
|
|
202
|
+
|
|
203
|
+
// perform semantic action
|
|
204
|
+
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
|
205
|
+
// default location, uses first token for firsts, last for lasts
|
|
206
|
+
yyval._$ = {
|
|
207
|
+
first_line: lstack[lstack.length-(len||1)].first_line,
|
|
208
|
+
last_line: lstack[lstack.length-1].last_line,
|
|
209
|
+
first_column: lstack[lstack.length-(len||1)].first_column,
|
|
210
|
+
last_column: lstack[lstack.length-1].last_column
|
|
211
|
+
};
|
|
212
|
+
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
|
213
|
+
|
|
214
|
+
if (typeof r !== 'undefined') {
|
|
215
|
+
return r;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// pop off stack
|
|
219
|
+
if (len) {
|
|
220
|
+
stack = stack.slice(0,-1*len*2);
|
|
221
|
+
vstack = vstack.slice(0, -1*len);
|
|
222
|
+
lstack = lstack.slice(0, -1*len);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
|
|
226
|
+
vstack.push(yyval.$);
|
|
227
|
+
lstack.push(yyval._$);
|
|
228
|
+
// goto new state = table[STATE][NONTERMINAL]
|
|
229
|
+
newState = table[stack[stack.length-2]][stack[stack.length-1]];
|
|
230
|
+
stack.push(newState);
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
case 3: // accept
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return true;
|
|
240
|
+
}};
|
|
241
|
+
/* Jison generated lexer */
|
|
242
|
+
var lexer = (function(){
|
|
243
|
+
var lexer = ({EOF:1,
|
|
244
|
+
parseError:function parseError(str, hash) {
|
|
245
|
+
if (this.yy.parseError) {
|
|
246
|
+
this.yy.parseError(str, hash);
|
|
247
|
+
} else {
|
|
248
|
+
throw new Error(str);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
setInput:function (input) {
|
|
252
|
+
this._input = input;
|
|
253
|
+
this._more = this._less = this.done = false;
|
|
254
|
+
this.yylineno = this.yyleng = 0;
|
|
255
|
+
this.yytext = this.matched = this.match = '';
|
|
256
|
+
this.conditionStack = ['INITIAL'];
|
|
257
|
+
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
|
258
|
+
return this;
|
|
259
|
+
},
|
|
260
|
+
input:function () {
|
|
261
|
+
var ch = this._input[0];
|
|
262
|
+
this.yytext+=ch;
|
|
263
|
+
this.yyleng++;
|
|
264
|
+
this.match+=ch;
|
|
265
|
+
this.matched+=ch;
|
|
266
|
+
var lines = ch.match(/\n/);
|
|
267
|
+
if (lines) this.yylineno++;
|
|
268
|
+
this._input = this._input.slice(1);
|
|
269
|
+
return ch;
|
|
270
|
+
},
|
|
271
|
+
unput:function (ch) {
|
|
272
|
+
this._input = ch + this._input;
|
|
273
|
+
return this;
|
|
274
|
+
},
|
|
275
|
+
more:function () {
|
|
276
|
+
this._more = true;
|
|
277
|
+
return this;
|
|
278
|
+
},
|
|
279
|
+
less:function (n) {
|
|
280
|
+
this._input = this.match.slice(n) + this._input;
|
|
281
|
+
},
|
|
282
|
+
pastInput:function () {
|
|
283
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
|
284
|
+
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
|
285
|
+
},
|
|
286
|
+
upcomingInput:function () {
|
|
287
|
+
var next = this.match;
|
|
288
|
+
if (next.length < 20) {
|
|
289
|
+
next += this._input.substr(0, 20-next.length);
|
|
290
|
+
}
|
|
291
|
+
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
|
|
292
|
+
},
|
|
293
|
+
showPosition:function () {
|
|
294
|
+
var pre = this.pastInput();
|
|
295
|
+
var c = new Array(pre.length + 1).join("-");
|
|
296
|
+
return pre + this.upcomingInput() + "\n" + c+"^";
|
|
297
|
+
},
|
|
298
|
+
next:function () {
|
|
299
|
+
if (this.done) {
|
|
300
|
+
return this.EOF;
|
|
301
|
+
}
|
|
302
|
+
if (!this._input) this.done = true;
|
|
303
|
+
|
|
304
|
+
var token,
|
|
305
|
+
match,
|
|
306
|
+
tempMatch,
|
|
307
|
+
index,
|
|
308
|
+
col,
|
|
309
|
+
lines;
|
|
310
|
+
if (!this._more) {
|
|
311
|
+
this.yytext = '';
|
|
312
|
+
this.match = '';
|
|
313
|
+
}
|
|
314
|
+
var rules = this._currentRules();
|
|
315
|
+
for (var i=0;i < rules.length; i++) {
|
|
316
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
|
317
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
|
318
|
+
match = tempMatch;
|
|
319
|
+
index = i;
|
|
320
|
+
if (!this.options.flex) break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (match) {
|
|
324
|
+
lines = match[0].match(/\n.*/g);
|
|
325
|
+
if (lines) this.yylineno += lines.length;
|
|
326
|
+
this.yylloc = {first_line: this.yylloc.last_line,
|
|
327
|
+
last_line: this.yylineno+1,
|
|
328
|
+
first_column: this.yylloc.last_column,
|
|
329
|
+
last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
|
|
330
|
+
this.yytext += match[0];
|
|
331
|
+
this.match += match[0];
|
|
332
|
+
this.yyleng = this.yytext.length;
|
|
333
|
+
this._more = false;
|
|
334
|
+
this._input = this._input.slice(match[0].length);
|
|
335
|
+
this.matched += match[0];
|
|
336
|
+
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
|
337
|
+
if (this.done && this._input) this.done = false;
|
|
338
|
+
if (token) return token;
|
|
339
|
+
else return;
|
|
340
|
+
}
|
|
341
|
+
if (this._input === "") {
|
|
342
|
+
return this.EOF;
|
|
343
|
+
} else {
|
|
344
|
+
this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
|
345
|
+
{text: "", token: null, line: this.yylineno});
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
lex:function lex() {
|
|
349
|
+
var r = this.next();
|
|
350
|
+
if (typeof r !== 'undefined') {
|
|
351
|
+
return r;
|
|
352
|
+
} else {
|
|
353
|
+
return this.lex();
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
begin:function begin(condition) {
|
|
357
|
+
this.conditionStack.push(condition);
|
|
358
|
+
},
|
|
359
|
+
popState:function popState() {
|
|
360
|
+
return this.conditionStack.pop();
|
|
361
|
+
},
|
|
362
|
+
_currentRules:function _currentRules() {
|
|
363
|
+
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
|
364
|
+
},
|
|
365
|
+
topState:function () {
|
|
366
|
+
return this.conditionStack[this.conditionStack.length-2];
|
|
367
|
+
},
|
|
368
|
+
pushState:function begin(condition) {
|
|
369
|
+
this.begin(condition);
|
|
370
|
+
}});
|
|
371
|
+
lexer.options = {};
|
|
372
|
+
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
|
373
|
+
|
|
374
|
+
var YYSTATE=YY_START
|
|
375
|
+
switch($avoiding_name_collisions) {
|
|
376
|
+
case 0:/* skip whitespace */
|
|
377
|
+
break;
|
|
378
|
+
case 1:return 6
|
|
379
|
+
break;
|
|
380
|
+
case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4
|
|
381
|
+
break;
|
|
382
|
+
case 3:return 17
|
|
383
|
+
break;
|
|
384
|
+
case 4:return 18
|
|
385
|
+
break;
|
|
386
|
+
case 5:return 23
|
|
387
|
+
break;
|
|
388
|
+
case 6:return 24
|
|
389
|
+
break;
|
|
390
|
+
case 7:return 22
|
|
391
|
+
break;
|
|
392
|
+
case 8:return 21
|
|
393
|
+
break;
|
|
394
|
+
case 9:return 10
|
|
395
|
+
break;
|
|
396
|
+
case 10:return 11
|
|
397
|
+
break;
|
|
398
|
+
case 11:return 8
|
|
399
|
+
break;
|
|
400
|
+
case 12:return 14
|
|
401
|
+
break;
|
|
402
|
+
case 13:return 'INVALID'
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
lexer.rules = [/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/];
|
|
407
|
+
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}};
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
;
|
|
411
|
+
return lexer;})()
|
|
412
|
+
parser.lexer = lexer;
|
|
413
|
+
return parser;
|
|
414
|
+
})();
|
|
415
|
+
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
|
|
416
|
+
exports.parser = jsonlint;
|
|
417
|
+
exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); }
|
|
418
|
+
exports.main = function commonjsMain(args) {
|
|
419
|
+
if (!args[1])
|
|
420
|
+
throw new Error('Usage: '+args[0]+' FILE');
|
|
421
|
+
if (typeof process !== 'undefined') {
|
|
422
|
+
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
|
|
423
|
+
} else {
|
|
424
|
+
var cwd = require("file").path(require("file").cwd());
|
|
425
|
+
var source = cwd.join(args[1]).read({charset: "utf-8"});
|
|
426
|
+
}
|
|
427
|
+
return exports.parser.parse(source);
|
|
428
|
+
}
|
|
429
|
+
if (typeof module !== 'undefined' && require.main === module) {
|
|
430
|
+
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
|
|
431
|
+
}
|
|
432
|
+
}
|