spoint 0.1.0 → 0.1.10
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.
- package/README.md +134 -209
- package/SKILL.md +95 -0
- package/apps/environment/index.js +200 -1
- package/apps/environment/models/decorative/.gitkeep +0 -0
- package/apps/environment/models/hazards/.gitkeep +0 -0
- package/apps/environment/models/interactive/.gitkeep +0 -0
- package/apps/environment/models/structures/.gitkeep +0 -0
- package/apps/environment/smartObjects.js +114 -0
- package/apps/interactable/index.js +155 -0
- package/apps/physics-crate/index.js +15 -9
- package/apps/power-crate/index.js +18 -12
- package/apps/tps-game/$GDUPI.vrm +0 -0
- package/apps/tps-game/Cleetus.vrm +0 -0
- package/apps/tps-game/index.js +185 -27
- package/apps/world/index.js +68 -22
- package/bin/create-app.js +337 -0
- package/client/ARControls.js +301 -0
- package/client/LoadingManager.js +117 -0
- package/client/MobileControls.js +1122 -0
- package/client/anim-lib.glb +0 -0
- package/client/animation.js +306 -0
- package/client/app.js +1341 -65
- package/client/camera.js +191 -33
- package/client/createLoadingScreen.js +69 -0
- package/client/editor/bridge.js +113 -0
- package/client/editor/css/main.css +794 -0
- package/client/editor/images/rotate.svg +4 -0
- package/client/editor/images/scale.svg +4 -0
- package/client/editor/images/translate.svg +4 -0
- package/client/editor/index.html +103 -0
- package/client/editor/js/Command.js +41 -0
- package/client/editor/js/Config.js +81 -0
- package/client/editor/js/Editor.js +785 -0
- package/client/editor/js/EditorControls.js +438 -0
- package/client/editor/js/History.js +321 -0
- package/client/editor/js/Loader.js +987 -0
- package/client/editor/js/LoaderUtils.js +90 -0
- package/client/editor/js/Menubar.Add.js +510 -0
- package/client/editor/js/Menubar.Edit.js +145 -0
- package/client/editor/js/Menubar.File.js +466 -0
- package/client/editor/js/Menubar.Help.js +73 -0
- package/client/editor/js/Menubar.Status.js +51 -0
- package/client/editor/js/Menubar.View.js +183 -0
- package/client/editor/js/Menubar.js +27 -0
- package/client/editor/js/Player.js +53 -0
- package/client/editor/js/Resizer.js +58 -0
- package/client/editor/js/Script.js +503 -0
- package/client/editor/js/Selector.js +102 -0
- package/client/editor/js/Sidebar.Geometry.BoxGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.BufferGeometry.js +115 -0
- package/client/editor/js/Sidebar.Geometry.CapsuleGeometry.js +97 -0
- package/client/editor/js/Sidebar.Geometry.CircleGeometry.js +97 -0
- package/client/editor/js/Sidebar.Geometry.CylinderGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.DodecahedronGeometry.js +73 -0
- package/client/editor/js/Sidebar.Geometry.ExtrudeGeometry.js +196 -0
- package/client/editor/js/Sidebar.Geometry.IcosahedronGeometry.js +73 -0
- package/client/editor/js/Sidebar.Geometry.LatheGeometry.js +98 -0
- package/client/editor/js/Sidebar.Geometry.Modifiers.js +73 -0
- package/client/editor/js/Sidebar.Geometry.OctahedronGeometry.js +74 -0
- package/client/editor/js/Sidebar.Geometry.PlaneGeometry.js +97 -0
- package/client/editor/js/Sidebar.Geometry.RingGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.ShapeGeometry.js +76 -0
- package/client/editor/js/Sidebar.Geometry.SphereGeometry.js +133 -0
- package/client/editor/js/Sidebar.Geometry.TetrahedronGeometry.js +74 -0
- package/client/editor/js/Sidebar.Geometry.TorusGeometry.js +109 -0
- package/client/editor/js/Sidebar.Geometry.TorusKnotGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.TubeGeometry.js +135 -0
- package/client/editor/js/Sidebar.Geometry.js +332 -0
- package/client/editor/js/Sidebar.Material.BooleanProperty.js +60 -0
- package/client/editor/js/Sidebar.Material.ColorProperty.js +87 -0
- package/client/editor/js/Sidebar.Material.ConstantProperty.js +62 -0
- package/client/editor/js/Sidebar.Material.MapProperty.js +249 -0
- package/client/editor/js/Sidebar.Material.NumberProperty.js +60 -0
- package/client/editor/js/Sidebar.Material.Program.js +73 -0
- package/client/editor/js/Sidebar.Material.RangeValueProperty.js +63 -0
- package/client/editor/js/Sidebar.Material.js +751 -0
- package/client/editor/js/Sidebar.Object.Animation.js +102 -0
- package/client/editor/js/Sidebar.Object.js +898 -0
- package/client/editor/js/Sidebar.Project.App.js +165 -0
- package/client/editor/js/Sidebar.Project.Image.js +225 -0
- package/client/editor/js/Sidebar.Project.Materials.js +82 -0
- package/client/editor/js/Sidebar.Project.Renderer.js +144 -0
- package/client/editor/js/Sidebar.Project.Video.js +242 -0
- package/client/editor/js/Sidebar.Project.js +31 -0
- package/client/editor/js/Sidebar.Properties.js +73 -0
- package/client/editor/js/Sidebar.Scene.js +585 -0
- package/client/editor/js/Sidebar.Script.js +129 -0
- package/client/editor/js/Sidebar.Settings.History.js +146 -0
- package/client/editor/js/Sidebar.Settings.Shortcuts.js +175 -0
- package/client/editor/js/Sidebar.Settings.js +60 -0
- package/client/editor/js/Sidebar.js +41 -0
- package/client/editor/js/Storage.js +98 -0
- package/client/editor/js/Strings.js +2028 -0
- package/client/editor/js/Toolbar.js +84 -0
- package/client/editor/js/Viewport.Controls.js +92 -0
- package/client/editor/js/Viewport.Info.js +136 -0
- package/client/editor/js/Viewport.Pathtracer.js +91 -0
- package/client/editor/js/Viewport.ViewHelper.js +39 -0
- package/client/editor/js/Viewport.XR.js +222 -0
- package/client/editor/js/Viewport.js +900 -0
- package/client/editor/js/commands/AddObjectCommand.js +68 -0
- package/client/editor/js/commands/AddScriptCommand.js +75 -0
- package/client/editor/js/commands/Commands.js +23 -0
- package/client/editor/js/commands/MoveObjectCommand.js +111 -0
- package/client/editor/js/commands/MultiCmdsCommand.js +85 -0
- package/client/editor/js/commands/RemoveObjectCommand.js +88 -0
- package/client/editor/js/commands/RemoveScriptCommand.js +81 -0
- package/client/editor/js/commands/SetColorCommand.js +73 -0
- package/client/editor/js/commands/SetGeometryCommand.js +87 -0
- package/client/editor/js/commands/SetGeometryValueCommand.js +70 -0
- package/client/editor/js/commands/SetMaterialColorCommand.js +86 -0
- package/client/editor/js/commands/SetMaterialCommand.js +79 -0
- package/client/editor/js/commands/SetMaterialMapCommand.js +143 -0
- package/client/editor/js/commands/SetMaterialRangeCommand.js +91 -0
- package/client/editor/js/commands/SetMaterialValueCommand.js +90 -0
- package/client/editor/js/commands/SetMaterialVectorCommand.js +79 -0
- package/client/editor/js/commands/SetPositionCommand.js +84 -0
- package/client/editor/js/commands/SetRotationCommand.js +84 -0
- package/client/editor/js/commands/SetScaleCommand.js +84 -0
- package/client/editor/js/commands/SetSceneCommand.js +103 -0
- package/client/editor/js/commands/SetScriptValueCommand.js +80 -0
- package/client/editor/js/commands/SetShadowValueCommand.js +73 -0
- package/client/editor/js/commands/SetUuidCommand.js +70 -0
- package/client/editor/js/commands/SetValueCommand.js +75 -0
- package/client/editor/js/libs/acorn/acorn.js +3236 -0
- package/client/editor/js/libs/acorn/acorn_loose.js +1299 -0
- package/client/editor/js/libs/acorn/walk.js +344 -0
- package/client/editor/js/libs/app/index.html +57 -0
- package/client/editor/js/libs/app.js +251 -0
- package/client/editor/js/libs/codemirror/addon/dialog.css +32 -0
- package/client/editor/js/libs/codemirror/addon/dialog.js +163 -0
- package/client/editor/js/libs/codemirror/addon/show-hint.css +36 -0
- package/client/editor/js/libs/codemirror/addon/show-hint.js +529 -0
- package/client/editor/js/libs/codemirror/addon/tern.css +87 -0
- package/client/editor/js/libs/codemirror/addon/tern.js +750 -0
- package/client/editor/js/libs/codemirror/codemirror.css +344 -0
- package/client/editor/js/libs/codemirror/codemirror.js +9849 -0
- package/client/editor/js/libs/codemirror/mode/glsl.js +233 -0
- package/client/editor/js/libs/codemirror/mode/javascript.js +959 -0
- package/client/editor/js/libs/codemirror/theme/monokai.css +41 -0
- package/client/editor/js/libs/esprima.js +6401 -0
- package/client/editor/js/libs/jsonlint.js +453 -0
- package/client/editor/js/libs/signals.min.js +14 -0
- package/client/editor/js/libs/tern-threejs/threejs.js +5031 -0
- package/client/editor/js/libs/ternjs/comment.js +87 -0
- package/client/editor/js/libs/ternjs/def.js +588 -0
- package/client/editor/js/libs/ternjs/doc_comment.js +401 -0
- package/client/editor/js/libs/ternjs/infer.js +1635 -0
- package/client/editor/js/libs/ternjs/polyfill.js +80 -0
- package/client/editor/js/libs/ternjs/signal.js +26 -0
- package/client/editor/js/libs/ternjs/tern.js +993 -0
- package/client/editor/js/libs/ui.js +1346 -0
- package/client/editor/js/libs/ui.three.js +855 -0
- package/client/facial-animation.js +455 -0
- package/client/index.html +7 -4
- package/client/loading.css +147 -0
- package/client/loading.html +25 -0
- package/client/style.css +251 -0
- package/package.json +7 -3
- package/server.js +9 -1
- package/src/apps/AppContext.js +1 -1
- package/src/apps/AppLoader.js +50 -37
- package/src/apps/AppRuntime.js +32 -8
- package/src/client/InputHandler.js +233 -0
- package/src/client/JitterBuffer.js +207 -0
- package/src/client/KalmanFilter.js +125 -0
- package/src/client/MessageHandler.js +101 -0
- package/src/client/PhysicsNetworkClient.js +141 -68
- package/src/client/ReconnectManager.js +62 -0
- package/src/client/SmoothInterpolation.js +127 -0
- package/src/client/SnapshotProcessor.js +144 -0
- package/src/connection/ConnectionManager.js +21 -3
- package/src/connection/SessionStore.js +13 -3
- package/src/index.client.js +4 -6
- package/src/netcode/EventLog.js +29 -15
- package/src/netcode/LagCompensator.js +25 -26
- package/src/netcode/NetworkState.js +4 -1
- package/src/netcode/PhysicsIntegration.js +20 -6
- package/src/netcode/PlayerManager.js +10 -2
- package/src/netcode/SnapshotEncoder.js +66 -19
- package/src/netcode/TickSystem.js +13 -4
- package/src/physics/World.js +66 -13
- package/src/protocol/msgpack.js +90 -63
- package/src/sdk/ReloadHandlers.js +12 -2
- package/src/sdk/ReloadManager.js +5 -0
- package/src/sdk/ServerHandlers.js +50 -11
- package/src/sdk/StaticHandler.js +22 -6
- package/src/sdk/TickHandler.js +101 -34
- package/src/sdk/scaffold.js +28 -0
- package/src/sdk/server.js +59 -33
- package/src/shared/movement.js +2 -1
- package/src/spatial/Octree.js +5 -0
- package/apps/interactive-door/index.js +0 -33
- package/apps/patrol-npc/index.js +0 -37
- package/src/connection/QualityMonitor.js +0 -46
- package/src/debug/StateInspector.js +0 -42
- package/src/index.js +0 -1
- package/src/index.server.js +0 -27
- package/src/protocol/Codec.js +0 -60
- package/src/protocol/SequenceTracker.js +0 -71
- package/src/sdk/ClientMessageHandler.js +0 -80
- package/src/sdk/client.js +0 -122
- package/world/kaira.glb +0 -0
- package/world/schwust.glb +0 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
// Full source:
|
|
2
|
+
//
|
|
3
|
+
// https://github.com/zaach/jsonlint
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) 2012 Zachary Carter
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
8
|
+
// copy of this software and associated documentation files (the "Software"),
|
|
9
|
+
// to deal in the Software without restriction, including without limitation
|
|
10
|
+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
11
|
+
// and/or sell copies of the Software, and to permit persons to whom the
|
|
12
|
+
// Software is furnished to do so, subject to the following conditions:
|
|
13
|
+
//
|
|
14
|
+
// The above copyright notice and this permission notice shall be included in
|
|
15
|
+
// all copies or substantial portions of the Software.
|
|
16
|
+
//
|
|
17
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
22
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL-
|
|
23
|
+
// INGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
/* Jison generated parser */
|
|
26
|
+
var jsonlint = (function(){
|
|
27
|
+
var parser = {trace: function trace() { },
|
|
28
|
+
yy: {},
|
|
29
|
+
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},
|
|
30
|
+
terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
|
|
31
|
+
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]],
|
|
32
|
+
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
|
33
|
+
|
|
34
|
+
var $0 = $$.length - 1;
|
|
35
|
+
switch (yystate) {
|
|
36
|
+
case 1: // replace escaped characters with actual character
|
|
37
|
+
this.$ = yytext.replace(/\\(\\|")/g, "$"+"1")
|
|
38
|
+
.replace(/\\n/g,'\n')
|
|
39
|
+
.replace(/\\r/g,'\r')
|
|
40
|
+
.replace(/\\t/g,'\t')
|
|
41
|
+
.replace(/\\v/g,'\v')
|
|
42
|
+
.replace(/\\f/g,'\f')
|
|
43
|
+
.replace(/\\b/g,'\b');
|
|
44
|
+
|
|
45
|
+
break;
|
|
46
|
+
case 2:this.$ = Number(yytext);
|
|
47
|
+
break;
|
|
48
|
+
case 3:this.$ = null;
|
|
49
|
+
break;
|
|
50
|
+
case 4:this.$ = true;
|
|
51
|
+
break;
|
|
52
|
+
case 5:this.$ = false;
|
|
53
|
+
break;
|
|
54
|
+
case 6:return this.$ = $$[$0-1];
|
|
55
|
+
break;
|
|
56
|
+
case 13:this.$ = {};
|
|
57
|
+
break;
|
|
58
|
+
case 14:this.$ = $$[$0-1];
|
|
59
|
+
break;
|
|
60
|
+
case 15:this.$ = [$$[$0-2], $$[$0]];
|
|
61
|
+
break;
|
|
62
|
+
case 16:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1];
|
|
63
|
+
break;
|
|
64
|
+
case 17:this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1];
|
|
65
|
+
break;
|
|
66
|
+
case 18:this.$ = [];
|
|
67
|
+
break;
|
|
68
|
+
case 19:this.$ = $$[$0-1];
|
|
69
|
+
break;
|
|
70
|
+
case 20:this.$ = [$$[$0]];
|
|
71
|
+
break;
|
|
72
|
+
case 21:this.$ = $$[$0-2]; $$[$0-2].push($$[$0]);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
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]}],
|
|
77
|
+
defaultActions: {16:[2,6]},
|
|
78
|
+
parseError: function parseError(str, hash) {
|
|
79
|
+
throw new Error(str);
|
|
80
|
+
},
|
|
81
|
+
parse: function parse(input) {
|
|
82
|
+
var self = this,
|
|
83
|
+
stack = [0],
|
|
84
|
+
vstack = [null], // semantic value stack
|
|
85
|
+
lstack = [], // location stack
|
|
86
|
+
table = this.table,
|
|
87
|
+
yytext = '',
|
|
88
|
+
yylineno = 0,
|
|
89
|
+
yyleng = 0,
|
|
90
|
+
recovering = 0,
|
|
91
|
+
TERROR = 2,
|
|
92
|
+
EOF = 1;
|
|
93
|
+
|
|
94
|
+
//this.reductionCount = this.shiftCount = 0;
|
|
95
|
+
|
|
96
|
+
this.lexer.setInput(input);
|
|
97
|
+
this.lexer.yy = this.yy;
|
|
98
|
+
this.yy.lexer = this.lexer;
|
|
99
|
+
if (typeof this.lexer.yylloc == 'undefined')
|
|
100
|
+
this.lexer.yylloc = {};
|
|
101
|
+
var yyloc = this.lexer.yylloc;
|
|
102
|
+
lstack.push(yyloc);
|
|
103
|
+
|
|
104
|
+
if (typeof this.yy.parseError === 'function')
|
|
105
|
+
this.parseError = this.yy.parseError;
|
|
106
|
+
|
|
107
|
+
function popStack (n) {
|
|
108
|
+
stack.length = stack.length - 2*n;
|
|
109
|
+
vstack.length = vstack.length - n;
|
|
110
|
+
lstack.length = lstack.length - n;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function lex() {
|
|
114
|
+
var token;
|
|
115
|
+
token = self.lexer.lex() || 1; // $end = 1
|
|
116
|
+
// if token isn't its numeric value, convert
|
|
117
|
+
if (typeof token !== 'number') {
|
|
118
|
+
token = self.symbols_[token] || token;
|
|
119
|
+
}
|
|
120
|
+
return token;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var symbol, preErrorSymbol, state, action, r, yyval={},p,len,newState, expected;
|
|
124
|
+
while (true) {
|
|
125
|
+
// retreive state number from top of stack
|
|
126
|
+
state = stack[stack.length-1];
|
|
127
|
+
|
|
128
|
+
// use default actions if available
|
|
129
|
+
if (this.defaultActions[state]) {
|
|
130
|
+
action = this.defaultActions[state];
|
|
131
|
+
} else {
|
|
132
|
+
if (symbol == null)
|
|
133
|
+
symbol = lex();
|
|
134
|
+
// read action for current state and first input
|
|
135
|
+
action = table[state] && table[state][symbol];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// handle parse error
|
|
139
|
+
_handle_error:
|
|
140
|
+
if (typeof action === 'undefined' || !action.length || !action[0]) {
|
|
141
|
+
|
|
142
|
+
if (!recovering) {
|
|
143
|
+
// Report error
|
|
144
|
+
expected = [];
|
|
145
|
+
for (p in table[state]) if (this.terminals_[p] && p > 2) {
|
|
146
|
+
expected.push("'"+this.terminals_[p]+"'");
|
|
147
|
+
}
|
|
148
|
+
var errStr = '';
|
|
149
|
+
if (this.lexer.showPosition) {
|
|
150
|
+
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
|
|
151
|
+
} else {
|
|
152
|
+
errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
|
|
153
|
+
(symbol == 1 /*EOF*/ ? "end of input" :
|
|
154
|
+
("'"+(this.terminals_[symbol] || symbol)+"'"));
|
|
155
|
+
}
|
|
156
|
+
this.parseError(errStr,
|
|
157
|
+
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// just recovered from another error
|
|
161
|
+
if (recovering == 3) {
|
|
162
|
+
if (symbol == EOF) {
|
|
163
|
+
throw new Error(errStr || 'Parsing halted.');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// discard current lookahead and grab another
|
|
167
|
+
yyleng = this.lexer.yyleng;
|
|
168
|
+
yytext = this.lexer.yytext;
|
|
169
|
+
yylineno = this.lexer.yylineno;
|
|
170
|
+
yyloc = this.lexer.yylloc;
|
|
171
|
+
symbol = lex();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// try to recover from error
|
|
175
|
+
while (1) {
|
|
176
|
+
// check for error recovery rule in this state
|
|
177
|
+
if ((TERROR.toString()) in table[state]) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
if (state == 0) {
|
|
181
|
+
throw new Error(errStr || 'Parsing halted.');
|
|
182
|
+
}
|
|
183
|
+
popStack(1);
|
|
184
|
+
state = stack[stack.length-1];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
preErrorSymbol = symbol; // save the lookahead token
|
|
188
|
+
symbol = TERROR; // insert generic error symbol as new lookahead
|
|
189
|
+
state = stack[stack.length-1];
|
|
190
|
+
action = table[state] && table[state][TERROR];
|
|
191
|
+
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// this shouldn't happen, unless resolve defaults are off
|
|
195
|
+
if (action[0] instanceof Array && action.length > 1) {
|
|
196
|
+
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
switch (action[0]) {
|
|
200
|
+
|
|
201
|
+
case 1: // shift
|
|
202
|
+
//this.shiftCount++;
|
|
203
|
+
|
|
204
|
+
stack.push(symbol);
|
|
205
|
+
vstack.push(this.lexer.yytext);
|
|
206
|
+
lstack.push(this.lexer.yylloc);
|
|
207
|
+
stack.push(action[1]); // push state
|
|
208
|
+
symbol = null;
|
|
209
|
+
if (!preErrorSymbol) { // normal execution/no error
|
|
210
|
+
yyleng = this.lexer.yyleng;
|
|
211
|
+
yytext = this.lexer.yytext;
|
|
212
|
+
yylineno = this.lexer.yylineno;
|
|
213
|
+
yyloc = this.lexer.yylloc;
|
|
214
|
+
if (recovering > 0)
|
|
215
|
+
recovering--;
|
|
216
|
+
} else { // error just occurred, resume old lookahead f/ before error
|
|
217
|
+
symbol = preErrorSymbol;
|
|
218
|
+
preErrorSymbol = null;
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
|
|
222
|
+
case 2: // reduce
|
|
223
|
+
//this.reductionCount++;
|
|
224
|
+
|
|
225
|
+
len = this.productions_[action[1]][1];
|
|
226
|
+
|
|
227
|
+
// perform semantic action
|
|
228
|
+
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
|
229
|
+
// default location, uses first token for firsts, last for lasts
|
|
230
|
+
yyval._$ = {
|
|
231
|
+
first_line: lstack[lstack.length-(len||1)].first_line,
|
|
232
|
+
last_line: lstack[lstack.length-1].last_line,
|
|
233
|
+
first_column: lstack[lstack.length-(len||1)].first_column,
|
|
234
|
+
last_column: lstack[lstack.length-1].last_column
|
|
235
|
+
};
|
|
236
|
+
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
|
237
|
+
|
|
238
|
+
if (typeof r !== 'undefined') {
|
|
239
|
+
return r;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// pop off stack
|
|
243
|
+
if (len) {
|
|
244
|
+
stack = stack.slice(0,-1*len*2);
|
|
245
|
+
vstack = vstack.slice(0, -1*len);
|
|
246
|
+
lstack = lstack.slice(0, -1*len);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
|
|
250
|
+
vstack.push(yyval.$);
|
|
251
|
+
lstack.push(yyval._$);
|
|
252
|
+
// goto new state = table[STATE][NONTERMINAL]
|
|
253
|
+
newState = table[stack[stack.length-2]][stack[stack.length-1]];
|
|
254
|
+
stack.push(newState);
|
|
255
|
+
break;
|
|
256
|
+
|
|
257
|
+
case 3: // accept
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
}};
|
|
264
|
+
/* Jison generated lexer */
|
|
265
|
+
var lexer = (function(){
|
|
266
|
+
var lexer = ({EOF:1,
|
|
267
|
+
parseError:function parseError(str, hash) {
|
|
268
|
+
if (this.yy.parseError) {
|
|
269
|
+
this.yy.parseError(str, hash);
|
|
270
|
+
} else {
|
|
271
|
+
throw new Error(str);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
setInput:function (input) {
|
|
275
|
+
this._input = input;
|
|
276
|
+
this._more = this._less = this.done = false;
|
|
277
|
+
this.yylineno = this.yyleng = 0;
|
|
278
|
+
this.yytext = this.matched = this.match = '';
|
|
279
|
+
this.conditionStack = ['INITIAL'];
|
|
280
|
+
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
|
281
|
+
return this;
|
|
282
|
+
},
|
|
283
|
+
input:function () {
|
|
284
|
+
var ch = this._input[0];
|
|
285
|
+
this.yytext+=ch;
|
|
286
|
+
this.yyleng++;
|
|
287
|
+
this.match+=ch;
|
|
288
|
+
this.matched+=ch;
|
|
289
|
+
var lines = ch.match(/\n/);
|
|
290
|
+
if (lines) this.yylineno++;
|
|
291
|
+
this._input = this._input.slice(1);
|
|
292
|
+
return ch;
|
|
293
|
+
},
|
|
294
|
+
unput:function (ch) {
|
|
295
|
+
this._input = ch + this._input;
|
|
296
|
+
return this;
|
|
297
|
+
},
|
|
298
|
+
more:function () {
|
|
299
|
+
this._more = true;
|
|
300
|
+
return this;
|
|
301
|
+
},
|
|
302
|
+
less:function (n) {
|
|
303
|
+
this._input = this.match.slice(n) + this._input;
|
|
304
|
+
},
|
|
305
|
+
pastInput:function () {
|
|
306
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
|
307
|
+
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
|
308
|
+
},
|
|
309
|
+
upcomingInput:function () {
|
|
310
|
+
var next = this.match;
|
|
311
|
+
if (next.length < 20) {
|
|
312
|
+
next += this._input.substr(0, 20-next.length);
|
|
313
|
+
}
|
|
314
|
+
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
|
|
315
|
+
},
|
|
316
|
+
showPosition:function () {
|
|
317
|
+
var pre = this.pastInput();
|
|
318
|
+
var c = new Array(pre.length + 1).join("-");
|
|
319
|
+
return pre + this.upcomingInput() + "\n" + c+"^";
|
|
320
|
+
},
|
|
321
|
+
next:function () {
|
|
322
|
+
if (this.done) {
|
|
323
|
+
return this.EOF;
|
|
324
|
+
}
|
|
325
|
+
if (!this._input) this.done = true;
|
|
326
|
+
|
|
327
|
+
var token,
|
|
328
|
+
match,
|
|
329
|
+
tempMatch,
|
|
330
|
+
index,
|
|
331
|
+
lines;
|
|
332
|
+
if (!this._more) {
|
|
333
|
+
this.yytext = '';
|
|
334
|
+
this.match = '';
|
|
335
|
+
}
|
|
336
|
+
var rules = this._currentRules();
|
|
337
|
+
for (var i=0;i < rules.length; i++) {
|
|
338
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
|
339
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
|
340
|
+
match = tempMatch;
|
|
341
|
+
index = i;
|
|
342
|
+
if (!this.options.flex) break;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (match) {
|
|
346
|
+
lines = match[0].match(/\n.*/g);
|
|
347
|
+
if (lines) this.yylineno += lines.length;
|
|
348
|
+
this.yylloc = {first_line: this.yylloc.last_line,
|
|
349
|
+
last_line: this.yylineno+1,
|
|
350
|
+
first_column: this.yylloc.last_column,
|
|
351
|
+
last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length};
|
|
352
|
+
this.yytext += match[0];
|
|
353
|
+
this.match += match[0];
|
|
354
|
+
this.yyleng = this.yytext.length;
|
|
355
|
+
this._more = false;
|
|
356
|
+
this._input = this._input.slice(match[0].length);
|
|
357
|
+
this.matched += match[0];
|
|
358
|
+
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
|
359
|
+
if (this.done && this._input) this.done = false;
|
|
360
|
+
if (token) return token;
|
|
361
|
+
else return;
|
|
362
|
+
}
|
|
363
|
+
if (this._input === "") {
|
|
364
|
+
return this.EOF;
|
|
365
|
+
} else {
|
|
366
|
+
this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
|
367
|
+
{text: "", token: null, line: this.yylineno});
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
lex:function lex() {
|
|
371
|
+
var r = this.next();
|
|
372
|
+
if (typeof r !== 'undefined') {
|
|
373
|
+
return r;
|
|
374
|
+
} else {
|
|
375
|
+
return this.lex();
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
begin:function begin(condition) {
|
|
379
|
+
this.conditionStack.push(condition);
|
|
380
|
+
},
|
|
381
|
+
popState:function popState() {
|
|
382
|
+
return this.conditionStack.pop();
|
|
383
|
+
},
|
|
384
|
+
_currentRules:function _currentRules() {
|
|
385
|
+
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
|
386
|
+
},
|
|
387
|
+
topState:function () {
|
|
388
|
+
return this.conditionStack[this.conditionStack.length-2];
|
|
389
|
+
},
|
|
390
|
+
pushState:function begin(condition) {
|
|
391
|
+
this.begin(condition);
|
|
392
|
+
}});
|
|
393
|
+
lexer.options = {};
|
|
394
|
+
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions) {
|
|
395
|
+
|
|
396
|
+
switch($avoiding_name_collisions) {
|
|
397
|
+
case 0:/* skip whitespace */
|
|
398
|
+
break;
|
|
399
|
+
case 1:return 6
|
|
400
|
+
break;
|
|
401
|
+
case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4
|
|
402
|
+
break;
|
|
403
|
+
case 3:return 17
|
|
404
|
+
break;
|
|
405
|
+
case 4:return 18
|
|
406
|
+
break;
|
|
407
|
+
case 5:return 23
|
|
408
|
+
break;
|
|
409
|
+
case 6:return 24
|
|
410
|
+
break;
|
|
411
|
+
case 7:return 22
|
|
412
|
+
break;
|
|
413
|
+
case 8:return 21
|
|
414
|
+
break;
|
|
415
|
+
case 9:return 10
|
|
416
|
+
break;
|
|
417
|
+
case 10:return 11
|
|
418
|
+
break;
|
|
419
|
+
case 11:return 8
|
|
420
|
+
break;
|
|
421
|
+
case 12:return 14
|
|
422
|
+
break;
|
|
423
|
+
case 13:return 'INVALID'
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
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)/,/^(?:$)/,/^(?:.)/];
|
|
428
|
+
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}};
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
;
|
|
432
|
+
return lexer;})()
|
|
433
|
+
parser.lexer = lexer;
|
|
434
|
+
return parser;
|
|
435
|
+
})();
|
|
436
|
+
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
|
|
437
|
+
exports.parser = jsonlint;
|
|
438
|
+
exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); }
|
|
439
|
+
exports.main = function commonjsMain(args) {
|
|
440
|
+
if (!args[1])
|
|
441
|
+
throw new Error('Usage: '+args[0]+' FILE');
|
|
442
|
+
if (typeof process !== 'undefined') {
|
|
443
|
+
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
|
|
444
|
+
} else {
|
|
445
|
+
var cwd = require("file").path(require("file").cwd());
|
|
446
|
+
var source = cwd.join(args[1]).read({charset: "utf-8"});
|
|
447
|
+
}
|
|
448
|
+
return exports.parser.parse(source);
|
|
449
|
+
}
|
|
450
|
+
if (typeof module !== 'undefined' && require.main === module) {
|
|
451
|
+
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
JS Signals <http://millermedeiros.github.com/js-signals/>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
Author: Miller Medeiros
|
|
6
|
+
Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)
|
|
7
|
+
*/
|
|
8
|
+
(function(i){function h(a,b,c,d,e){this._listener=b;this._isOnce=c;this.context=d;this._signal=a;this._priority=e||0}function g(a,b){if(typeof a!=="function")throw Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b));}function e(){this._bindings=[];this._prevParams=null;var a=this;this.dispatch=function(){e.prototype.dispatch.apply(a,arguments)}}h.prototype={active:!0,params:null,execute:function(a){var b;this.active&&this._listener&&(a=this.params?this.params.concat(a):
|
|
9
|
+
a,b=this._listener.apply(this.context,a),this._isOnce&&this.detach());return b},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal;delete this._listener;delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+
|
|
10
|
+
", isBound:"+this.isBound()+", active:"+this.active+"]"}};e.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(a,b,c,d){var e=this._indexOfListener(a,c);if(e!==-1){if(a=this._bindings[e],a.isOnce()!==b)throw Error("You cannot add"+(b?"":"Once")+"() then add"+(!b?"":"Once")+"() the same listener without removing the relationship first.");}else a=new h(this,a,b,c,d),this._addBinding(a);this.memorize&&this._prevParams&&a.execute(this._prevParams);return a},
|
|
11
|
+
_addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(var c=this._bindings.length,d;c--;)if(d=this._bindings[c],d._listener===a&&d.context===b)return c;return-1},has:function(a,b){return this._indexOfListener(a,b)!==-1},add:function(a,b,c){g(a,"add");return this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){g(a,"addOnce");return this._registerListener(a,
|
|
12
|
+
!0,b,c)},remove:function(a,b){g(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams=
|
|
13
|
+
b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var f=e;f.Signal=e;typeof define==="function"&&define.amd?define(function(){return f}):typeof module!=="undefined"&&module.exports?module.exports=f:i.signals=
|
|
14
|
+
f})(this);
|