(JavaScript port)
19 | * @author Jono Brandel (requirified/optimization port)
20 | *
21 | * @version 0.3
22 | * @date March 25, 2012
23 | */
24 |
25 | /**
26 | * The whole kit and kaboodle.
27 | *
28 | * @class
29 | */
30 | var ParticleSystem = function() {
31 |
32 | this.__equilibriumCriteria = { particles: true, springs: true, attractions: true };
33 | this.__equilibrium = false; // are we at equilibrium?
34 | this.__optimized = false;
35 |
36 | this.particles = [];
37 | this.springs = [];
38 | this.attractions = [];
39 | this.forces = [];
40 | this.integrator = new Integrator(this);
41 | this.hasDeadParticles = false;
42 |
43 | var args = arguments.length;
44 |
45 | if (args === 1) {
46 | this.gravity = new Vector(0, arguments[0]);
47 | this.drag = ParticleSystem.DEFAULT_DRAG;
48 | } else if (args === 2) {
49 | this.gravity = new Vector(0, arguments[0]);
50 | this.drag = arguments[1];
51 | } else if (args === 3) {
52 | this.gravity = new Vector(arguments[0], arguments[1]);
53 | this.drag = arguments[3];
54 | } else {
55 | this.gravity = new Vector(0, ParticleSystem.DEFAULT_GRAVITY);
56 | this.drag = ParticleSystem.DEFAULT_DRAG;
57 | }
58 |
59 | };
60 |
61 | _.extend(ParticleSystem, {
62 |
63 | DEFAULT_GRAVITY: 0,
64 |
65 | DEFAULT_DRAG: 0.001,
66 |
67 | Attraction: Attraction,
68 |
69 | Integrator: Integrator,
70 |
71 | Particle: Particle,
72 |
73 | Spring: Spring,
74 |
75 | Vector: Vector
76 |
77 | });
78 |
79 | _.extend(ParticleSystem.prototype, {
80 |
81 | /**
82 | * Set whether to optimize the simulation. This enables the check of whether
83 | * particles are moving.
84 | */
85 | optimize: function(b) {
86 | this.__optimized = !!b;
87 | return this;
88 | },
89 |
90 | /**
91 | * Set the gravity of the ParticleSystem.
92 | */
93 | setGravity: function(x, y) {
94 | this.gravity.set(x, y);
95 | return this;
96 | },
97 |
98 | /**
99 | * Sets the criteria for equilibrium
100 | */
101 | setEquilibriumCriteria: function(particles, springs, attractions) {
102 | this.__equilibriumCriteria.particles = !!particles;
103 | this.__equilibriumCriteria.springs = !!springs;
104 | this.__equilibriumCriteria.attractions = !!attractions;
105 | },
106 |
107 | /**
108 | * Update the integrator
109 | */
110 | tick: function() {
111 | this.integrator.step(arguments.length === 0 ? 1 : arguments[0]);
112 | if (this.__optimized) {
113 | this.__equilibrium = !this.needsUpdate();
114 | }
115 | return this;
116 | },
117 |
118 | /**
119 | * Checks all springs and attractions to see if the contained particles are
120 | * inert / resting and returns a boolean.
121 | */
122 | needsUpdate: function() {
123 |
124 | var i = 0;
125 |
126 | if (this.__equilibriumCriteria.particles) {
127 | for (i = 0, l = this.particles.length; i < l; i++) {
128 | if (!this.particles[i].resting()) {
129 | return true;
130 | }
131 | }
132 | }
133 |
134 | if (this.__equilibriumCriteria.springs) {
135 | for (i = 0, l = this.springs.length; i < l; i++) {
136 | if (!this.springs[i].resting()) {
137 | return true;
138 | }
139 | }
140 | }
141 |
142 | if (this.__equilibriumCriteria.attractions) {
143 | for (i = 0, l = this.attractions.length; i < l; i++) {
144 | if (!this.attractions[i].resting()) {
145 | return true;
146 | }
147 | }
148 | }
149 |
150 | return false;
151 |
152 | },
153 |
154 | /**
155 | * Add a particle to the ParticleSystem.
156 | */
157 | addParticle: function(p) {
158 |
159 | this.particles.push(p);
160 | return this;
161 |
162 | },
163 |
164 | /**
165 | * Add a spring to the ParticleSystem.
166 | */
167 | addSpring: function(s) {
168 |
169 | this.springs.push(s);
170 | return this;
171 |
172 | },
173 |
174 | /**
175 | * Add an attraction to the ParticleSystem.
176 | */
177 | addAttraction: function(a) {
178 |
179 | this.attractions.push(a);
180 | return this;
181 |
182 | },
183 |
184 | /**
185 | * Makes and then adds Particle to ParticleSystem.
186 | */
187 | makeParticle: function(m, x, y) {
188 |
189 | var mass = _.isNumber(m) ? m : 1.0;
190 | var x = x || 0;
191 | var y = y || 0;
192 |
193 | var p = new Particle(mass);
194 | p.position.set(x, y);
195 | this.addParticle(p);
196 | return p;
197 |
198 | },
199 |
200 | /**
201 | * Makes and then adds Spring to ParticleSystem.
202 | */
203 | makeSpring: function(a, b, k, d, l) {
204 |
205 | var spring = new Spring(a, b, k, d, l);
206 | this.addSpring(spring);
207 | return spring;
208 |
209 | },
210 |
211 | /**
212 | * Makes and then adds Attraction to ParticleSystem.
213 | */
214 | makeAttraction: function(a, b, k, d) {
215 |
216 | var attraction = new Attraction(a, b, k, d);
217 | this.addAttraction(attraction);
218 | return attraction;
219 |
220 | },
221 |
222 | /**
223 | * Wipe the ParticleSystem clean.
224 | */
225 | clear: function() {
226 |
227 | this.particles.length = 0;
228 | this.springs.length = 0;
229 | this.attractions.length = 0;
230 |
231 | },
232 |
233 | /**
234 | * Calculate and apply forces.
235 | */
236 | applyForces: function() {
237 |
238 | var i, p;
239 |
240 | if (!this.gravity.isZero()) {
241 |
242 | for (i = 0; i < this.particles.length; i++) {
243 | this.particles[i].force.addSelf(this.gravity);
244 | }
245 |
246 | }
247 |
248 | var t = new Vector();
249 |
250 | for (i = 0; i < this.particles.length; i++) {
251 |
252 | p = this.particles[i];
253 | t.set(p.velocity.x * -1 * this.drag, p.velocity.y * -1 * this.drag);
254 | p.force.addSelf(t);
255 |
256 | }
257 |
258 | for (i = 0; i < this.springs.length; i++) {
259 | this.springs[i].update();
260 | }
261 |
262 | for (i = 0; i < this.attractions.length; i++) {
263 | this.attractions[i].update();
264 | }
265 |
266 | for (i = 0; i < this.forces.length; i++) {
267 | this.forces[i].update();
268 | }
269 |
270 | return this;
271 |
272 | },
273 |
274 | /**
275 | * Clear all particles in the system.
276 | */
277 | clearForces: function() {
278 | for (var i = 0; i < this.particles.length; i++) {
279 | this.particles[i].clear();
280 | }
281 | return this;
282 | }
283 |
284 | });
285 |
286 | return ParticleSystem;
287 |
288 | });
289 |
--------------------------------------------------------------------------------
/src/Physics.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'ParticleSystem',
3 | 'requestAnimationFrame',
4 | 'common'
5 | ], function(ParticleSystem, raf, _) {
6 |
7 | var instances = [];
8 |
9 | /**
10 | * Extended singleton instance of ParticleSystem with convenience methods for
11 | * Request Animation Frame.
12 | * @class
13 | */
14 | var Physics = function() {
15 |
16 | var _this = this;
17 |
18 | this.playing = false;
19 |
20 | ParticleSystem.apply(this, arguments);
21 |
22 | this.animations = [];
23 |
24 | this.equilibriumCallbacks = [];
25 |
26 | instances.push(this);
27 |
28 | };
29 |
30 | _.extend(Physics, ParticleSystem, {
31 |
32 | superclass: ParticleSystem
33 |
34 | });
35 |
36 | _.extend(Physics.prototype, ParticleSystem.prototype, {
37 |
38 | /**
39 | * Play the animation loop. Doesn't affect whether in equilibrium or not.
40 | */
41 | play: function() {
42 |
43 | if (this.playing) {
44 | return this;
45 | }
46 |
47 | this.playing = true;
48 | this.__equilibrium = false;
49 |
50 | return this;
51 |
52 | },
53 |
54 | /**
55 | * Pause the animation loop. Doesn't affect whether in equilibrium or not.
56 | */
57 | pause: function() {
58 |
59 | this.playing = false;
60 | return this;
61 |
62 | },
63 |
64 | /**
65 | * Toggle between playing and pausing the simulation.
66 | */
67 | toggle: function() {
68 |
69 | if (this.playing) {
70 | this.pause();
71 | } else {
72 | this.play();
73 | }
74 |
75 | return this;
76 |
77 | },
78 |
79 | onUpdate: function(func) {
80 |
81 | if (_.indexOf(this.animations, func) >= 0 || !_.isFunction(func)) {
82 | return this;
83 | }
84 |
85 | this.animations.push(func);
86 |
87 | return this;
88 |
89 | },
90 |
91 | onEquilibrium: function(func) {
92 |
93 | if (_.indexOf(this.equilibriumCallbacks, func) >= 0 || !_.isFunction(func)) {
94 | return this;
95 | }
96 |
97 | this.equilibriumCallbacks.push(func);
98 |
99 | return this;
100 |
101 | },
102 |
103 | /**
104 | * Call update after values in the system have changed and this will fire
105 | * it's own Request Animation Frame to update until things have settled
106 | * to equilibrium — at which point the system will stop updating.
107 | */
108 | update: function() {
109 |
110 | if (this.__optimized && this.__equilibrium) {
111 | return this;
112 | }
113 |
114 | var i;
115 |
116 | this.tick();
117 |
118 | for (i = 0; i < this.animations.length; i++) {
119 | this.animations[i]();
120 | }
121 |
122 | if (this.__optimized && this.__equilibrium){
123 |
124 | for (i = 0; i < this.equilibriumCallbacks.length; i++) {
125 | this.equilibriumCallbacks[i]();
126 | }
127 |
128 | }
129 |
130 | return this;
131 |
132 | }
133 |
134 | });
135 |
136 | function loop() {
137 |
138 | raf(loop);
139 |
140 | for (var i = 0; i < instances.length; i++) {
141 | var system = instances[i];
142 | if (system.playing) {
143 | system.update();
144 | }
145 | }
146 |
147 | }
148 |
149 | loop();
150 |
151 | return Physics;
152 |
153 | });
154 |
--------------------------------------------------------------------------------
/src/Spring.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'Vector',
3 | 'common'
4 | ], function(Vector, _) {
5 |
6 | var Spring = function(a, b, k, d, l) {
7 |
8 | this.constant = k;
9 | this.damping = d;
10 | this.length = l;
11 | this.a = a;
12 | this.b = b;
13 | this.on = true;
14 |
15 | };
16 |
17 | _.extend(Spring.prototype, {
18 |
19 | /**
20 | * Returns the distance between particle a and particle b
21 | * in 2D space.
22 | */
23 | currentLength: function() {
24 | return this.a.position.distanceTo(this.b.position);
25 | },
26 |
27 | /**
28 | * Update spring logic.
29 | */
30 | update: function() {
31 |
32 | var a = this.a;
33 | var b = this.b;
34 | if (!(this.on && (!a.fixed || !b.fixed))) return this;
35 |
36 | var a2b = new Vector().sub(a.position, b.position);
37 | var d = a2b.length();
38 |
39 | if (d === 0) {
40 | a2b.clear();
41 | } else {
42 | a2b.divideScalar(d); // Essentially normalize
43 | }
44 |
45 | var fspring = -1 * (d - this.length) * this.constant;
46 |
47 | var va2b = new Vector().sub(a.velocity, b.velocity);
48 |
49 | var fdamping = -1 * this.damping * va2b.dot(a2b);
50 |
51 | var fr = fspring + fdamping;
52 |
53 | a2b.multiplyScalar(fr);
54 |
55 | if (!a.fixed) {
56 | a.force.addSelf(a2b);
57 | }
58 | if (!b.fixed) {
59 | b.force.subSelf(a2b);
60 | }
61 |
62 | return this;
63 |
64 | },
65 |
66 | /**
67 | * Returns a boolean describing whether the spring is resting or not.
68 | * Convenient for knowing whether or not the spring needs another update
69 | * tick.
70 | */
71 | resting: function() {
72 |
73 | var a = this.a;
74 | var b = this.b;
75 | var l = this.length;
76 |
77 | return !this.on || (a.fixed && b.fixed)
78 | || (a.fixed && (l === 0 ? b.position.equals(a.position) : b.position.distanceTo(a.position) <= l) && b.resting())
79 | || (b.fixed && (l === 0 ? a.position.equals(b.position) : a.position.distanceTo(b.position) <= l) && a.resting());
80 |
81 | }
82 |
83 | });
84 |
85 | return Spring;
86 |
87 | });
88 |
--------------------------------------------------------------------------------
/src/Vector.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author mr.doob / http://mrdoob.com/
3 | * @author philogb / http://blog.thejit.org/
4 | * @author egraether / http://egraether.com/
5 | * @author zz85 / http://www.lab4games.net/zz85/blog
6 | * @author jonobr1 / http://jonobr1.com/
7 | */
8 |
9 | define([
10 | 'common'
11 | ], function(_) {
12 |
13 | /**
14 | * A two dimensional vector.
15 | */
16 | var Vector = function(x, y) {
17 |
18 | this.x = x || 0;
19 | this.y = y || 0;
20 |
21 | };
22 |
23 | _.extend(Vector.prototype, {
24 |
25 | set: function(x, y) {
26 | this.x = x;
27 | this.y = y;
28 | return this;
29 | },
30 |
31 | copy: function(v) {
32 | this.x = v.x;
33 | this.y = v.y;
34 | return this;
35 | },
36 |
37 | clear: function() {
38 | this.x = 0;
39 | this.y = 0;
40 | return this;
41 | },
42 |
43 | clone: function() {
44 | return new Vector(this.x, this.y);
45 | },
46 |
47 | add: function(v1, v2) {
48 | this.x = v1.x + v2.x;
49 | this.y = v1.y + v2.y;
50 | return this;
51 | },
52 |
53 | addSelf: function(v) {
54 | this.x += v.x;
55 | this.y += v.y;
56 | return this;
57 | },
58 |
59 | sub: function(v1, v2) {
60 | this.x = v1.x - v2.x;
61 | this.y = v1.y - v2.y;
62 | return this;
63 | },
64 |
65 | subSelf: function(v) {
66 | this.x -= v.x;
67 | this.y -= v.y;
68 | return this;
69 | },
70 |
71 | multiplySelf: function(v) {
72 | this.x *= v.x;
73 | this.y *= v.y;
74 | return this;
75 | },
76 |
77 | multiplyScalar: function(s) {
78 | this.x *= s;
79 | this.y *= s;
80 | return this;
81 | },
82 |
83 | divideScalar: function(s) {
84 | if (s) {
85 | this.x /= s;
86 | this.y /= s;
87 | } else {
88 | this.set(0, 0);
89 | }
90 | return this;
91 | },
92 |
93 | negate: function() {
94 | return this.multiplyScalar(-1);
95 | },
96 |
97 | dot: function(v) {
98 | return this.x * v.x + this.y * v.y;
99 | },
100 |
101 | lengthSquared: function() {
102 | return this.x * this.x + this.y * this.y;
103 | },
104 |
105 | length: function() {
106 | return Math.sqrt(this.lengthSquared());
107 | },
108 |
109 | normalize: function() {
110 | return this.divideScalar(this.length());
111 | },
112 |
113 | distanceTo: function(v) {
114 | return Math.sqrt(this.distanceToSquared(v));
115 | },
116 |
117 | distanceToSquared: function(v) {
118 | var dx = this.x - v.x, dy = this.y - v.y;
119 | return dx * dx + dy * dy;
120 | },
121 |
122 | setLength: function(l) {
123 | return this.normalize().multiplyScalar(l);
124 | },
125 |
126 | equals: function(v) {
127 | return (this.distanceTo(v) < 0.0001 /* almost same position */);
128 | },
129 |
130 | lerp: function(v, t) {
131 | var x = (v.x - this.x) * t + this.x;
132 | var y = (v.y - this.y) * t + this.y;
133 | return this.set(x, y);
134 | },
135 |
136 | isZero: function() {
137 | return (this.length() < 0.0001 /* almost zero */ );
138 | }
139 |
140 | });
141 |
142 | return Vector;
143 |
144 | });
145 |
--------------------------------------------------------------------------------
/src/common.js:
--------------------------------------------------------------------------------
1 | define([
2 | ], function() {
3 |
4 | /**
5 | * Pulled only what's needed from:
6 | *
7 | * Underscore.js 1.3.3
8 | * (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
9 | * http://documentcloud.github.com/underscore
10 | */
11 |
12 | var breaker = {};
13 | var ArrayProto = Array.prototype;
14 | var ObjProto = Object.prototype;
15 | var hasOwnProperty = ObjProto.hasOwnProperty;
16 | var slice = ArrayProto.slice;
17 | var nativeForEach = ArrayProto.forEach;
18 | var nativeIndexOf = ArrayProto.indexOf;
19 | var toString = ObjProto.toString;
20 |
21 | var has = function(obj, key) {
22 | return hasOwnProperty.call(obj, key);
23 | };
24 |
25 | var each = function(obj, iterator, context) {
26 |
27 | if (obj == null) return;
28 | if (nativeForEach && obj.forEach === nativeForEach) {
29 | obj.forEach(iterator, context);
30 | } else if (obj.length === +obj.length) {
31 | for (var i = 0, l = obj.length; i < l; i++) {
32 | if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
33 | }
34 | } else {
35 | for (var key in obj) {
36 | if (_.has(obj, key)) {
37 | if (iterator.call(context, obj[key], key, obj) === breaker) return;
38 | }
39 | }
40 | }
41 |
42 | };
43 |
44 | var identity = function(value) {
45 | return value;
46 | };
47 |
48 | var sortedIndex = function(array, obj, iterator) {
49 | iterator || (iterator = identity);
50 | var low = 0, high = array.length;
51 | while (low < high) {
52 | var mid = (low + high) >> 1;
53 | iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
54 | }
55 | return low;
56 | };
57 |
58 | return {
59 |
60 | has: has,
61 |
62 | each: each,
63 |
64 | extend: function(obj) {
65 | each(slice.call(arguments, 1), function(source) {
66 | for (var prop in source) {
67 | obj[prop] = source[prop];
68 | }
69 | });
70 | return obj;
71 | },
72 |
73 | indexOf: function(array, item, isSorted) {
74 | if (array == null) return -1;
75 | var i, l;
76 | if (isSorted) {
77 | i = sortedIndex(array, item);
78 | return array[i] === item ? i : -1;
79 | }
80 | if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
81 | for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
82 | return -1;
83 | },
84 |
85 | sortedIndex: sortedIndex,
86 |
87 | identity: identity,
88 |
89 | isNumber: function(obj) {
90 | return toString.call(obj) == '[object Number]';
91 | },
92 |
93 | isFunction: function(obj) {
94 | return toString.call(obj) == '[object Function]' || typeof obj == 'function';
95 | },
96 |
97 | isUndefined: function(obj) {
98 | return obj === void 0;
99 | },
100 |
101 | isNull: function(obj) {
102 | return obj === null;
103 | }
104 |
105 | }
106 |
107 | });
108 |
--------------------------------------------------------------------------------
/src/requestAnimationFrame.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 |
3 | var root = root || this;
4 |
5 | /*
6 | * Requirified version of Paul Irish's request animation frame.
7 | * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
8 | */
9 |
10 | return root.requestAnimationFrame ||
11 | root.webkitRequestAnimationFrame ||
12 | root.mozRequestAnimationFrame ||
13 | root.oRequestAnimationFrame ||
14 | root.msRequestAnimationFrame ||
15 | function (callback) {
16 | root.setTimeout(callback, 1000 / 60);
17 | };
18 | });
--------------------------------------------------------------------------------
/styles/_prettify.scss:
--------------------------------------------------------------------------------
1 | @import 'bourbon/bourbon';
2 | @import 'shared';
3 |
4 | $black: #000;
5 | $white: #efefef;
6 |
7 | $bg_color: $white;
8 | $text_color: $black;
9 | $border_color: rgba(0,0,0,0.125);
10 |
11 | // Secondary Colors
12 |
13 | $yellow: rgb(178, 138, 9);
14 | $dark_yellow: rgb(72, 44, 0);
15 |
16 | $violet: rgb(242, 25, 255);
17 | $dark_violet: rgb(72, 13, 127);
18 |
19 | $green: rgb(0, 255, 200);
20 | $dark_green: rgb(10, 100, 80);
21 |
22 | $blue: rgb(20, 144, 204);
23 | $dark_blue: rgb(14, 100, 140);
24 |
25 | code, pre {
26 | font-family: 'lekton', monospace;
27 | }
28 | pre {
29 | font-size: $font_size;
30 | color: $text_color;
31 | margin: $margin * 2 0;
32 | display: block;
33 | background-color: shade($bg_color, 7%);
34 | // text-shadow: 1px 1px rgba(0,0,0,0.2);
35 | }
36 | pre .nocode { background-color: none; color: #000; }
37 | pre .str { color: $dark_green; }
38 | pre .kwd { color: $dark_violet; }
39 | pre .com { color: tint($text_color, 25%); font-style: italic; }
40 | pre .typ { color: $dark_green; }
41 | pre .lit { color: $dark_blue; }
42 | pre .pun { color: $text_color; }
43 | pre .pln { color: $text_color; }
44 | pre .tag { color: $dark_green; }
45 | pre .atn { color: $dark_violet; }
46 | pre .atv { color: $green; }
47 | pre .dec { color: $green; }
48 |
49 | /* Specify class=linenums on a pre to get line numbering */
50 | ol.linenums {
51 | margin: 0;
52 | color: shade($bg_color, 25%);
53 | }
54 | li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9 {
55 | list-style-type: decimal;
56 | padding: 0 $font_size / 2;
57 | width: 560px; // Width of an M * 80, the common spacing of an IDE / lint
58 | border-right: 1px solid $bg_color;
59 | background-color: shade($bg_color, 5%);
60 | overflow: visible;
61 | }
62 | /* Alternate shading for lines */
63 | li.L1,li.L3,li.L5,li.L7,li.L9 {
64 | background: shade($bg_color, 4%);
65 | }
--------------------------------------------------------------------------------
/styles/_shared.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * Styling the index page requires bourbon
3 | * http://thoughtbot.com/bourbon/
4 | */
5 |
6 | @import 'bourbon/bourbon';
7 |
8 | $font-size: 14px;
9 | $line-height: 20px;
10 | $font-color: #333;
11 | $highlight: #fff;
12 | $margin: 12px;
13 | $background: #e2dddb;
--------------------------------------------------------------------------------
/styles/style.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Styling the index page requires bourbon
3 | * http://thoughtbot.com/bourbon/
4 | */
5 | /**
6 | * Styling the index page requires bourbon
7 | * http://thoughtbot.com/bourbon/
8 | */
9 | code, pre {
10 | font-family: 'lekton', monospace; }
11 |
12 | pre {
13 | font-size: 14px;
14 | color: black;
15 | margin: 24px 0;
16 | display: block;
17 | background-color: #dedede; }
18 |
19 | pre .nocode {
20 | background-color: none;
21 | color: #000; }
22 |
23 | pre .str {
24 | color: #0a6450; }
25 |
26 | pre .kwd {
27 | color: #480d7f; }
28 |
29 | pre .com {
30 | color: #3f3f3f;
31 | font-style: italic; }
32 |
33 | pre .typ {
34 | color: #0a6450; }
35 |
36 | pre .lit {
37 | color: #0e648c; }
38 |
39 | pre .pun {
40 | color: black; }
41 |
42 | pre .pln {
43 | color: black; }
44 |
45 | pre .tag {
46 | color: #0a6450; }
47 |
48 | pre .atn {
49 | color: #480d7f; }
50 |
51 | pre .atv {
52 | color: #00ffc8; }
53 |
54 | pre .dec {
55 | color: #00ffc8; }
56 |
57 | /* Specify class=linenums on a pre to get line numbering */
58 | ol.linenums {
59 | margin: 0;
60 | color: #b3b3b3; }
61 |
62 | li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 {
63 | list-style-type: decimal;
64 | padding: 0 7px;
65 | width: 560px;
66 | border-right: 1px solid #efefef;
67 | background-color: #e3e3e3;
68 | overflow: visible; }
69 |
70 | /* Alternate shading for lines */
71 | li.L1, li.L3, li.L5, li.L7, li.L9 {
72 | background: #e5e5e5; }
73 |
74 | * {
75 | margin: 0;
76 | padding: 0; }
77 |
78 | body {
79 | font-size: 14px;
80 | line-height: 20px;
81 | font-family: 'Open Sans', Lucida, sans-serif;
82 | text-shadow: 1px 1px rgba(255, 255, 255, 0.75);
83 | color: #333333;
84 | background: #e2dddb; }
85 | body.marbles {
86 | background: #000; }
87 | body.marbles canvas {
88 | cursor: none; }
89 |
90 | a:link, a:visited {
91 | color: #333333; }
92 | a:hover, a:active {
93 | text-decoration: none; }
94 |
95 | #content section, #toc section {
96 | margin-bottom: 20px; }
97 | #content section:after, #toc section:after {
98 | position: relative;
99 | display: block;
100 | content: "";
101 | height: 0;
102 | width: 100%;
103 | margin: 20px 0 0px;
104 | padding: 0;
105 | border-bottom: 1px solid white; }
106 | #content section p, #toc section p {
107 | margin-bottom: 20px; }
108 | #content ul, #content ol, #content, #toc ul, #toc ol, #toc {
109 | list-style: none; }
110 | #content ul li:not(:last-child), #content ol li:not(:last-child), #content li:not(:last-child), #toc ul li:not(:last-child), #toc ol li:not(:last-child), #toc li:not(:last-child) {
111 | margin-bottom: 20px; }
112 | #content ul ol, #content ol ol, #content ol, #toc ul ol, #toc ol ol, #toc ol {
113 | list-style: decimal; }
114 | #content ul ol li, #content ol ol li, #content ol li, #toc ul ol li, #toc ol ol li, #toc ol li {
115 | margin-left: 20px;
116 | width: 75%;
117 | margin-bottom: 0; }
118 | #content dd, #toc dd {
119 | margin-bottom: 20px; }
120 | #content #documentation dt, #toc #documentation dt {
121 | font-weight: bold; }
122 | #content code,
123 | #content pre, #toc code, #toc pre {
124 | font-family: 'Lekton', monospace; }
125 | #content pre, #toc pre {
126 | padding: 0 20px;
127 | background: rgba(255, 255, 255, 0.3);
128 | width: 540px; }
129 |
130 | #toc {
131 | position: fixed;
132 | top: 0;
133 | left: 0;
134 | bottom: 0;
135 | overflow-y: auto;
136 | overflow-x: hidden;
137 | border-right: 1px solid white; }
138 | #toc > ul {
139 | width: 125px;
140 | padding: 40px 20px; }
141 | #toc li ul {
142 | margin: 10px 0;
143 | padding: 0 0 0 10px; }
144 | #toc li ul li {
145 | margin-bottom: 0 !important; }
146 |
147 | div.live-demo {
148 | position: relative;
149 | border: 1px solid white;
150 | -webkit-user-select: none;
151 | -moz-user-select: none;
152 | -ms-user-select: none;
153 | user-select: none;
154 | cursor: pointer; }
155 | div.live-demo:after {
156 | position: absolute;
157 | top: 0;
158 | left: 0;
159 | margin: 10px;
160 | background: rgba(255, 255, 255, 0.75);
161 | padding: 4px 6px;
162 | -webkit-border-radius: 3px;
163 | -moz-border-radius: 3px;
164 | -ms-border-radius: 3px;
165 | -o-border-radius: 3px;
166 | border-radius: 3px;
167 | opacity: 0.5;
168 | content: "Play"; }
169 | div.live-demo:hover:after {
170 | opacity: 1.0; }
171 | div.live-demo.playing:after {
172 | content: "Pause"; }
173 |
174 | #content {
175 | position: absolute;
176 | top: 0;
177 | left: 185px;
178 | width: 600px;
179 | padding: 40px 0;
180 | border-left: 1px solid white; }
181 | #content > * {
182 | padding-left: 20px; }
183 | #content p.method, #content p.property, #content p.constructor, #content p.example {
184 | margin-bottom: 0; }
185 |
186 | h1, h2, h3, h4, h5, h6 {
187 | margin-bottom: 20px; }
188 |
189 | h1 {
190 | font-size: 42px;
191 | line-height: 60px; }
192 |
193 | h2 {
194 | font-size: 20px;
195 | line-height: 40px;
196 | text-transform: capitalize; }
197 |
198 | canvas,
199 | svg {
200 | display: block;
201 | margin: 0 auto;
202 | cursor: pointer; }
203 | canvas path,
204 | svg path {
205 | opacity: 0.9; }
206 | canvas path:hover,
207 | canvas path.fixed,
208 | svg path:hover,
209 | svg path.fixed {
210 | stroke: #ffa000; }
211 |
212 | #legend {
213 | position: fixed;
214 | bottom: 0;
215 | left: 50%;
216 | border-right: 1px solid white;
217 | border-top: 1px solid white;
218 | border-left: 1px solid white;
219 | padding: 20px 40px;
220 | background: #e2dddb;
221 | -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
222 | -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
223 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
224 | margin-left: -162px; }
225 |
226 | ::selection,
227 | ::-moz-selection,
228 | ::-webkit-selection {
229 | background: rgba(255, 160, 0, 0.66); }
230 |
--------------------------------------------------------------------------------
/styles/style.scss:
--------------------------------------------------------------------------------
1 | @import 'bourbon/bourbon';
2 | @import 'shared';
3 | @import 'prettify';
4 |
5 | * {
6 | margin: 0;
7 | padding: 0;
8 | }
9 |
10 | body {
11 | font-size: $font-size;
12 | line-height: $line-height;
13 | font-family: 'Open Sans', Lucida, sans-serif;
14 | text-shadow: 1px 1px rgba(255, 255, 255, 0.75);
15 | color: $font-color;
16 | background: $background;
17 | &.marbles {
18 | background: #000;
19 | canvas {
20 | cursor: none;
21 | }
22 | }
23 | }
24 |
25 | a {
26 | &:link,
27 | &:visited {
28 | color: $font-color;
29 | }
30 | &:hover,
31 | &:active {
32 | text-decoration: none;
33 | }
34 | }
35 |
36 | #content, #toc {
37 |
38 | section {
39 |
40 | margin-bottom: $line-height;
41 | &:after {
42 | position: relative;
43 | display: block;
44 | content: "";
45 | height: 0;
46 | width: 100%;
47 | margin: $line-height 0 $line-height -$line-height;
48 | padding: 0;
49 | border-bottom: 1px solid $highlight;
50 | }
51 |
52 | p {
53 | margin-bottom: $line-height;
54 | }
55 |
56 | }
57 |
58 | ul, ol, & {
59 | list-style: none;
60 | li {
61 | &:not(:last-child) {
62 | margin-bottom: $line-height;
63 | }
64 | }
65 | ol {
66 | list-style: decimal;
67 | // list-style-position: inside;
68 | li {
69 | margin-left: $line-height;
70 | width: 75%;
71 | margin-bottom: 0;
72 | }
73 | }
74 | }
75 |
76 | dd {
77 | margin-bottom: $line-height;
78 | }
79 |
80 | #documentation {
81 | dt {
82 | font-weight: bold;
83 | }
84 | }
85 |
86 | code,
87 | pre {
88 | font-family: 'Lekton', monospace;
89 | }
90 |
91 | pre {
92 | padding: 0 $line-height;
93 | background: rgba(255, 255, 255, 0.3);
94 | width: 600 - $line-height * 3;
95 | }
96 |
97 | }
98 |
99 | #toc {
100 |
101 | position: fixed;
102 | top: 0;
103 | left: 0;
104 | bottom: 0;
105 | overflow-y: auto;
106 | overflow-x: hidden;
107 | border-right: 1px solid $highlight;
108 |
109 | & > ul {
110 | width: 185px - $line-height * 3;
111 | padding: $line-height * 2 $line-height;
112 | }
113 |
114 | li ul {
115 |
116 | margin: $line-height / 2 0;
117 | padding: 0 0 0 $line-height / 2;
118 |
119 | li {
120 | margin-bottom: 0 !important;
121 | }
122 |
123 | }
124 |
125 | }
126 |
127 | div.live-demo {
128 |
129 | position: relative;
130 | border: 1px solid white;
131 | @include user-select(none);
132 | cursor: pointer;
133 |
134 | &:after {
135 | position: absolute;
136 | top: 0;
137 | left: 0;
138 | margin: $line-height / 2;
139 | background: rgba(255, 255, 255, 0.75);
140 | padding: 4px 6px;
141 | @include border-radius(3px);
142 | opacity: 0.5;
143 | content: "Play";
144 | }
145 |
146 | &:hover:after {
147 | opacity: 1.0;
148 | }
149 |
150 | &.playing:after {
151 | content: "Pause";
152 | }
153 |
154 | }
155 |
156 | #content {
157 | position: absolute;
158 | top: 0;
159 | left: 185px;
160 | width: 600px;
161 | padding: $line-height * 2 0;
162 | border-left: 1px solid $highlight;
163 | & > * {
164 | padding-left: $line-height;
165 | }
166 | p.method, p.property, p.constructor, p.example {
167 | margin-bottom: 0;
168 | }
169 | }
170 |
171 | h1, h2, h3, h4, h5, h6 {
172 | margin-bottom: $line-height;
173 | }
174 |
175 | h1 {
176 | font-size: $font-size * 3;
177 | line-height: $line-height * 3;
178 | }
179 |
180 | h2 {
181 | font-size: 20px;
182 | line-height: 2 * $line-height;
183 | text-transform: capitalize;
184 | }
185 |
186 | canvas,
187 | svg {
188 | display: block;
189 | margin: 0 auto;
190 | cursor: pointer;
191 |
192 | path {
193 | opacity: 0.9;
194 | }
195 | path:hover,
196 | path.fixed {
197 | stroke: rgb(255, 160, 0);
198 | }
199 |
200 | }
201 |
202 | #legend {
203 | position: fixed;
204 | bottom: 0;
205 | left: 50%;
206 | border-right: 1px solid white;
207 | border-top: 1px solid white;
208 | border-left: 1px solid white;
209 | padding: $line-height $line-height * 2;
210 | background: $background;
211 | @include box-shadow(0 0 10px rgba(0,0,0,0.125));
212 | margin-left: -162px;
213 | }
214 |
215 | ::selection,
216 | ::-moz-selection,
217 | ::-webkit-selection {
218 | background: rgba(255, 160, 0, 0.66);
219 | }
--------------------------------------------------------------------------------
/third-party/prettify/lang-apollo.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2009 Onno Hommes.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | /**
17 | * @fileoverview
18 | * Registers a language handler for the AGC/AEA Assembly Language as described
19 | * at http://virtualagc.googlecode.com
20 | *
21 | * This file could be used by goodle code to allow syntax highlight for
22 | * Virtual AGC SVN repository or if you don't want to commonize
23 | * the header for the agc/aea html assembly listing.
24 | *
25 | * @author ohommes@alumni.cmu.edu
26 | */
27 |
28 | PR['registerLangHandler'](
29 | PR['createSimpleLexer'](
30 | [
31 | // A line comment that starts with ;
32 | [PR['PR_COMMENT'], /^#[^\r\n]*/, null, '#'],
33 | // Whitespace
34 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
35 | // A double quoted, possibly multi-line, string.
36 | [PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
37 | ],
38 | [
39 | [PR['PR_KEYWORD'], /^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,null],
40 | [PR['PR_TYPE'], /^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],
41 | // A single quote possibly followed by a word that optionally ends with
42 | // = ! or ?.
43 | [PR['PR_LITERAL'],
44 | /^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
45 | // Any word including labels that optionally ends with = ! or ?.
46 | [PR['PR_PLAIN'],
47 | /^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
48 | // A printable non-space non-special character
49 | [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0()\"\\\';]+/]
50 | ]),
51 | ['apollo', 'agc', 'aea']);
52 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-clj.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license Copyright (C) 2011 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for Clojure.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | *
(my lisp code)
25 | * The lang-cl class identifies the language as common lisp.
26 | * This file supports the following language extensions:
27 | * lang-clj - Clojure
28 | *
29 | *
30 | * I used lang-lisp.js as the basis for this adding the clojure specific
31 | * keywords and syntax.
32 | *
33 | * "Name" = 'Clojure'
34 | * "Author" = 'Rich Hickey'
35 | * "Version" = '1.2'
36 | * "About" = 'Clojure is a lisp for the jvm with concurrency primitives and a richer set of types.'
37 | *
38 | *
39 | * I used Clojure.org Reference as
40 | * the basis for the reserved word list.
41 | *
42 | *
43 | * @author jwall@google.com
44 | */
45 |
46 | PR['registerLangHandler'](
47 | PR['createSimpleLexer'](
48 | [
49 | // clojure has more paren types than minimal lisp.
50 | ['opn', /^[\(\{\[]+/, null, '([{'],
51 | ['clo', /^[\)\}\]]+/, null, ')]}'],
52 | // A line comment that starts with ;
53 | [PR['PR_COMMENT'], /^;[^\r\n]*/, null, ';'],
54 | // Whitespace
55 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
56 | // A double quoted, possibly multi-line, string.
57 | [PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
58 | ],
59 | [
60 | // clojure has a much larger set of keywords
61 | [PR['PR_KEYWORD'], /^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/, null],
62 | [PR['PR_TYPE'], /^:[0-9a-zA-Z\-]+/]
63 | ]),
64 | ['clj']);
65 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2009 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for CSS.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | *
25 | *
26 | *
27 | * http://www.w3.org/TR/CSS21/grammar.html Section G2 defines the lexical
28 | * grammar. This scheme does not recognize keywords containing escapes.
29 | *
30 | * @author mikesamuel@gmail.com
31 | */
32 |
33 | PR['registerLangHandler'](
34 | PR['createSimpleLexer'](
35 | [
36 | // The space production
37 | [PR['PR_PLAIN'], /^[ \t\r\n\f]+/, null, ' \t\r\n\f']
38 | ],
39 | [
40 | // Quoted strings. and
41 | [PR['PR_STRING'],
42 | /^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/, null],
43 | [PR['PR_STRING'],
44 | /^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/, null],
45 | ['lang-css-str', /^url\(([^\)\"\']*)\)/i],
46 | [PR['PR_KEYWORD'],
47 | /^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,
48 | null],
49 | // A property name -- an identifier followed by a colon.
50 | ['lang-css-kw', /^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],
51 | // A C style block comment. The production.
52 | [PR['PR_COMMENT'], /^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],
53 | // Escaping text spans
54 | [PR['PR_COMMENT'], /^(?:)/],
55 | // A number possibly containing a suffix.
56 | [PR['PR_LITERAL'], /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],
57 | // A hex color
58 | [PR['PR_LITERAL'], /^#(?:[0-9a-f]{3}){1,2}/i],
59 | // An identifier
60 | [PR['PR_PLAIN'],
61 | /^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],
62 | // A run of punctuation
63 | [PR['PR_PUNCTUATION'], /^[^\s\w\'\"]+/]
64 | ]),
65 | ['css']);
66 | PR['registerLangHandler'](
67 | PR['createSimpleLexer']([],
68 | [
69 | [PR['PR_KEYWORD'],
70 | /^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]
71 | ]),
72 | ['css-kw']);
73 | PR['registerLangHandler'](
74 | PR['createSimpleLexer']([],
75 | [
76 | [PR['PR_STRING'], /^[^\)\"\']+/]
77 | ]),
78 | ['css-str']);
79 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-go.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2010 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for the Go language..
20 | *
21 | * Based on the lexical grammar at
22 | * http://golang.org/doc/go_spec.html#Lexical_elements
23 | *
24 | * Go uses a minimal style for highlighting so the below does not distinguish
25 | * strings, keywords, literals, etc. by design.
26 | * From a discussion with the Go designers:
27 | *
28 | * On Thursday, July 22, 2010, Mike Samuel <...> wrote:
29 | * > On Thu, Jul 22, 2010, Rob 'Commander' Pike <...> wrote:
30 | * >> Personally, I would vote for the subdued style godoc presents at http://golang.org
31 | * >>
32 | * >> Not as fancy as some like, but a case can be made it's the official style.
33 | * >> If people want more colors, I wouldn't fight too hard, in the interest of
34 | * >> encouragement through familiarity, but even then I would ask to shy away
35 | * >> from technicolor starbursts.
36 | * >
37 | * > Like http://golang.org/pkg/go/scanner/ where comments are blue and all
38 | * > other content is black? I can do that.
39 | *
40 | *
41 | * @author mikesamuel@gmail.com
42 | */
43 |
44 | PR['registerLangHandler'](
45 | PR['createSimpleLexer'](
46 | [
47 | // Whitespace is made up of spaces, tabs and newline characters.
48 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
49 | // Not escaped as a string. See note on minimalism above.
50 | [PR['PR_PLAIN'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])+(?:\'|$)|`[^`]*(?:`|$))/, null, '"\'']
51 | ],
52 | [
53 | // Block comments are delimited by /* and */.
54 | // Single-line comments begin with // and extend to the end of a line.
55 | [PR['PR_COMMENT'], /^(?:\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/],
56 | [PR['PR_PLAIN'], /^(?:[^\/\"\'`]|\/(?![\/\*]))+/i]
57 | ]),
58 | ['go']);
59 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-hs.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2009 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for Haskell.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | * (my lisp code)
25 | * The lang-cl class identifies the language as common lisp.
26 | * This file supports the following language extensions:
27 | * lang-cl - Common Lisp
28 | * lang-el - Emacs Lisp
29 | * lang-lisp - Lisp
30 | * lang-scm - Scheme
31 | *
32 | *
33 | * I used http://www.informatik.uni-freiburg.de/~thiemann/haskell/haskell98-report-html/syntax-iso.html
34 | * as the basis, but ignore the way the ncomment production nests since this
35 | * makes the lexical grammar irregular. It might be possible to support
36 | * ncomments using the lookbehind filter.
37 | *
38 | *
39 | * @author mikesamuel@gmail.com
40 | */
41 |
42 | PR['registerLangHandler'](
43 | PR['createSimpleLexer'](
44 | [
45 | // Whitespace
46 | // whitechar -> newline | vertab | space | tab | uniWhite
47 | // newline -> return linefeed | return | linefeed | formfeed
48 | [PR['PR_PLAIN'], /^[\t\n\x0B\x0C\r ]+/, null, '\t\n\x0B\x0C\r '],
49 | // Single line double and single-quoted strings.
50 | // char -> ' (graphic<' | \> | space | escape<\&>) '
51 | // string -> " {graphic<" | \> | space | escape | gap}"
52 | // escape -> \ ( charesc | ascii | decimal | o octal
53 | // | x hexadecimal )
54 | // charesc -> a | b | f | n | r | t | v | \ | " | ' | &
55 | [PR['PR_STRING'], /^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,
56 | null, '"'],
57 | [PR['PR_STRING'], /^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,
58 | null, "'"],
59 | // decimal -> digit{digit}
60 | // octal -> octit{octit}
61 | // hexadecimal -> hexit{hexit}
62 | // integer -> decimal
63 | // | 0o octal | 0O octal
64 | // | 0x hexadecimal | 0X hexadecimal
65 | // float -> decimal . decimal [exponent]
66 | // | decimal exponent
67 | // exponent -> (e | E) [+ | -] decimal
68 | [PR['PR_LITERAL'],
69 | /^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,
70 | null, '0123456789']
71 | ],
72 | [
73 | // Haskell does not have a regular lexical grammar due to the nested
74 | // ncomment.
75 | // comment -> dashes [ any {any}] newline
76 | // ncomment -> opencom ANYseq {ncomment ANYseq}closecom
77 | // dashes -> '--' {'-'}
78 | // opencom -> '{-'
79 | // closecom -> '-}'
80 | [PR['PR_COMMENT'], /^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],
81 | // reservedid -> case | class | data | default | deriving | do
82 | // | else | if | import | in | infix | infixl | infixr
83 | // | instance | let | module | newtype | of | then
84 | // | type | where | _
85 | [PR['PR_KEYWORD'], /^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/, null],
86 | // qvarid -> [ modid . ] varid
87 | // qconid -> [ modid . ] conid
88 | // varid -> (small {small | large | digit | ' })
89 | // conid -> large {small | large | digit | ' }
90 | // modid -> conid
91 | // small -> ascSmall | uniSmall | _
92 | // ascSmall -> a | b | ... | z
93 | // uniSmall -> any Unicode lowercase letter
94 | // large -> ascLarge | uniLarge
95 | // ascLarge -> A | B | ... | Z
96 | // uniLarge -> any uppercase or titlecase Unicode letter
97 | [PR['PR_PLAIN'], /^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],
98 | // matches the symbol production
99 | [PR['PR_PUNCTUATION'], /^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]
100 | ]),
101 | ['hs']);
102 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-lisp.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2008 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for Common Lisp and related languages.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | * (my lisp code)
25 | * The lang-cl class identifies the language as common lisp.
26 | * This file supports the following language extensions:
27 | * lang-cl - Common Lisp
28 | * lang-el - Emacs Lisp
29 | * lang-lisp - Lisp
30 | * lang-scm - Scheme
31 | *
32 | *
33 | * I used http://www.devincook.com/goldparser/doc/meta-language/grammar-LISP.htm
34 | * as the basis, but added line comments that start with ; and changed the atom
35 | * production to disallow unquoted semicolons.
36 | *
37 | * "Name" = 'LISP'
38 | * "Author" = 'John McCarthy'
39 | * "Version" = 'Minimal'
40 | * "About" = 'LISP is an abstract language that organizes ALL'
41 | * | 'data around "lists".'
42 | *
43 | * "Start Symbol" = [s-Expression]
44 | *
45 | * {Atom Char} = {Printable} - {Whitespace} - [()"\'']
46 | *
47 | * Atom = ( {Atom Char} | '\'{Printable} )+
48 | *
49 | * [s-Expression] ::= [Quote] Atom
50 | * | [Quote] '(' [Series] ')'
51 | * | [Quote] '(' [s-Expression] '.' [s-Expression] ')'
52 | *
53 | * [Series] ::= [s-Expression] [Series]
54 | * |
55 | *
56 | * [Quote] ::= '' !Quote = do not evaluate
57 | * |
58 | *
59 | *
60 | * I used Practical Common Lisp as
61 | * the basis for the reserved word list.
62 | *
63 | *
64 | * @author mikesamuel@gmail.com
65 | */
66 |
67 | PR['registerLangHandler'](
68 | PR['createSimpleLexer'](
69 | [
70 | ['opn', /^\(+/, null, '('],
71 | ['clo', /^\)+/, null, ')'],
72 | // A line comment that starts with ;
73 | [PR['PR_COMMENT'], /^;[^\r\n]*/, null, ';'],
74 | // Whitespace
75 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
76 | // A double quoted, possibly multi-line, string.
77 | [PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
78 | ],
79 | [
80 | [PR['PR_KEYWORD'], /^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, null],
81 | [PR['PR_LITERAL'],
82 | /^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],
83 | // A single quote possibly followed by a word that optionally ends with
84 | // = ! or ?.
85 | [PR['PR_LITERAL'],
86 | /^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
87 | // A word that optionally ends with = ! or ?.
88 | [PR['PR_PLAIN'],
89 | /^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
90 | // A printable non-space non-special character
91 | [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0()\"\\\';]+/]
92 | ]),
93 | ['cl', 'el', 'lisp', 'scm']);
94 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-lua.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2008 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for Lua.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | * (my Lua code)
25 | *
26 | *
27 | * I used http://www.lua.org/manual/5.1/manual.html#2.1
28 | * Because of the long-bracket concept used in strings and comments, Lua does
29 | * not have a regular lexical grammar, but luckily it fits within the space
30 | * of irregular grammars supported by javascript regular expressions.
31 | *
32 | * @author mikesamuel@gmail.com
33 | */
34 |
35 | PR['registerLangHandler'](
36 | PR['createSimpleLexer'](
37 | [
38 | // Whitespace
39 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
40 | // A double or single quoted, possibly multi-line, string.
41 | [PR['PR_STRING'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/, null, '"\'']
42 | ],
43 | [
44 | // A comment is either a line comment that starts with two dashes, or
45 | // two dashes preceding a long bracketed block.
46 | [PR['PR_COMMENT'], /^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],
47 | // A long bracketed block not preceded by -- is a string.
48 | [PR['PR_STRING'], /^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],
49 | [PR['PR_KEYWORD'], /^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/, null],
50 | // A number is a hex integer literal, a decimal real literal, or in
51 | // scientific notation.
52 | [PR['PR_LITERAL'],
53 | /^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
54 | // An identifier
55 | [PR['PR_PLAIN'], /^[a-z_]\w*/i],
56 | // A run of punctuation
57 | [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]
58 | ]),
59 | ['lua']);
60 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-ml.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2008 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for OCaml, SML, F# and similar languages.
20 | *
21 | * Based on the lexical grammar at
22 | * http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc270597388
23 | *
24 | * @author mikesamuel@gmail.com
25 | */
26 |
27 | PR['registerLangHandler'](
28 | PR['createSimpleLexer'](
29 | [
30 | // Whitespace is made up of spaces, tabs and newline characters.
31 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
32 | // #if ident/#else/#endif directives delimit conditional compilation
33 | // sections
34 | [PR['PR_COMMENT'],
35 | /^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,
36 | null, '#'],
37 | // A double or single quoted, possibly multi-line, string.
38 | // F# allows escaped newlines in strings.
39 | [PR['PR_STRING'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])(?:\'|$))/, null, '"\'']
40 | ],
41 | [
42 | // Block comments are delimited by (* and *) and may be
43 | // nested. Single-line comments begin with // and extend to
44 | // the end of a line.
45 | // TODO: (*...*) comments can be nested. This does not handle that.
46 | [PR['PR_COMMENT'], /^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],
47 | [PR['PR_KEYWORD'], /^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
48 | // A number is a hex integer literal, a decimal real literal, or in
49 | // scientific notation.
50 | [PR['PR_LITERAL'],
51 | /^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
52 | [PR['PR_PLAIN'], /^(?:[a-z_][\w']*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],
53 | // A printable non-space non-special character
54 | [PR['PR_PUNCTUATION'], /^[^\t\n\r \xA0\"\'\w]+/]
55 | ]),
56 | ['fs', 'ml']);
57 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-n.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2011 Zimin A.V.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | /**
17 | * @fileoverview
18 | * Registers a language handler for the Nemerle language.
19 | * http://nemerle.org
20 | * @author Zimin A.V.
21 | */
22 | (function () {
23 | var keywords = 'abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|'
24 | + 'fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|'
25 | + 'null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|'
26 | + 'syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|'
27 | + 'assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|'
28 | + 'otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield';
29 |
30 | var shortcutStylePatterns = [
31 | [PR.PR_STRING, /^(?:\'(?:[^\\\'\r\n]|\\.)*\'|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, '"'],
32 | [PR.PR_COMMENT, /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/, null, '#'],
33 | [PR.PR_PLAIN, /^\s+/, null, ' \r\n\t\xA0']
34 | ];
35 |
36 | var fallthroughStylePatterns = [
37 | [PR.PR_STRING, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null],
38 | [PR.PR_STRING, /^<#(?:[^#>])*(?:#>|$)/, null],
39 | [PR.PR_STRING, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, null],
40 | [PR.PR_COMMENT, /^\/\/[^\r\n]*/, null],
41 | [PR.PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null],
42 | [PR.PR_KEYWORD, new RegExp('^(?:' + keywords + ')\\b'), null],
43 | [PR.PR_TYPE, /^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/, null],
44 | [PR.PR_LITERAL, /^@[a-z_$][a-z_$@0-9]*/i, null],
45 | [PR.PR_TYPE, /^@[A-Z]+[a-z][A-Za-z_$@0-9]*/, null],
46 | [PR.PR_PLAIN, /^'?[A-Za-z_$][a-z_$@0-9]*/i, null],
47 | [PR.PR_LITERAL, new RegExp(
48 | '^(?:'
49 | // A hex number
50 | + '0x[a-f0-9]+'
51 | // or an octal or decimal number,
52 | + '|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
53 | // possibly in scientific notation
54 | + '(?:e[+\\-]?\\d+)?'
55 | + ')'
56 | // with an optional modifier like UL for unsigned long
57 | + '[a-z]*', 'i'), null, '0123456789'],
58 |
59 | [PR.PR_PUNCTUATION, /^.[^\s\w\.$@\'\"\`\/\#]*/, null]
60 | ];
61 | PR.registerLangHandler(PR.createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns), ['n', 'nemerle']);
62 | })();
63 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-proto.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2006 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | /**
17 | * @fileoverview
18 | * Registers a language handler for Protocol Buffers as described at
19 | * http://code.google.com/p/protobuf/.
20 | *
21 | * Based on the lexical grammar at
22 | * http://research.microsoft.com/fsharp/manual/spec2.aspx#_Toc202383715
23 | *
24 | * @author mikesamuel@gmail.com
25 | */
26 |
27 | PR['registerLangHandler'](PR['sourceDecorator']({
28 | 'keywords': (
29 | 'bytes,default,double,enum,extend,extensions,false,'
30 | + 'group,import,max,message,option,'
31 | + 'optional,package,repeated,required,returns,rpc,service,'
32 | + 'syntax,to,true'),
33 | 'types': /^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,
34 | 'cStyleComments': true
35 | }), ['proto']);
36 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-scala.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2010 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | /**
17 | * @fileoverview
18 | * Registers a language handler for Scala.
19 | *
20 | * Derived from http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/reference/SyntaxSummary.tex
21 | *
22 | * @author mikesamuel@gmail.com
23 | */
24 |
25 | PR['registerLangHandler'](
26 | PR['createSimpleLexer'](
27 | [
28 | // Whitespace
29 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
30 | // A double or single quoted string
31 | // or a triple double-quoted multi-line string.
32 | [PR['PR_STRING'],
33 | /^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/,
34 | null, '"'],
35 | [PR['PR_LITERAL'], /^`(?:[^\r\n\\`]|\\.)*`?/, null, '`'],
36 | [PR['PR_PUNCTUATION'], /^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/, null,
37 | '!#%&()*+,-:;<=>?@[\\]^{|}~']
38 | ],
39 | [
40 | // A symbol literal is a single quote followed by an identifier with no
41 | // single quote following
42 | // A character literal has single quotes on either side
43 | [PR['PR_STRING'], /^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/],
44 | [PR['PR_LITERAL'], /^'[a-zA-Z_$][\w$]*(?!['$\w])/],
45 | [PR['PR_KEYWORD'], /^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/],
46 | [PR['PR_LITERAL'], /^(?:true|false|null|this)\b/],
47 | [PR['PR_LITERAL'], /^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i],
48 | // Treat upper camel case identifiers as types.
49 | [PR['PR_TYPE'], /^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/],
50 | [PR['PR_PLAIN'], /^[$a-zA-Z_][\w$]*/],
51 | [PR['PR_COMMENT'], /^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],
52 | [PR['PR_PUNCTUATION'], /^(?:\.+|\/)/]
53 | ]),
54 | ['scala']);
55 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-sql.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2008 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for SQL.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | * (my SQL code)
25 | *
26 | *
27 | * http://savage.net.au/SQL/sql-99.bnf.html is the basis for the grammar, and
28 | * http://msdn.microsoft.com/en-us/library/aa238507(SQL.80).aspx as the basis
29 | * for the keyword list.
30 | *
31 | * @author mikesamuel@gmail.com
32 | */
33 |
34 | PR['registerLangHandler'](
35 | PR['createSimpleLexer'](
36 | [
37 | // Whitespace
38 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
39 | // A double or single quoted, possibly multi-line, string.
40 | [PR['PR_STRING'], /^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/, null,
41 | '"\'']
42 | ],
43 | [
44 | // A comment is either a line comment that starts with two dashes, or
45 | // two dashes preceding a long bracketed block.
46 | [PR['PR_COMMENT'], /^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],
47 | [PR['PR_KEYWORD'], /^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|MATCH|MERGE|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|USING|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i, null],
48 | // A number is a hex integer literal, a decimal real literal, or in
49 | // scientific notation.
50 | [PR['PR_LITERAL'],
51 | /^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
52 | // An identifier
53 | [PR['PR_PLAIN'], /^[a-z_][\w-]*/i],
54 | // A run of punctuation
55 | [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]
56 | ]),
57 | ['sql']);
58 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-tex.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2011 Martin S.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /**
16 | * @fileoverview
17 | * Support for tex highlighting as discussed on
18 | * meta.tex.stackexchange.com.
19 | *
20 | * @author Martin S.
21 | */
22 |
23 | PR.registerLangHandler(
24 | PR.createSimpleLexer(
25 | [
26 | // whitespace
27 | [PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
28 | // all comments begin with '%'
29 | [PR.PR_COMMENT, /^%[^\r\n]*/, null, '%']
30 | ],
31 | [
32 | //[PR.PR_DECLARATION, /^\\([egx]?def|(new|renew|provide)(command|environment))\b/],
33 | // any command starting with a \ and contains
34 | // either only letters (a-z,A-Z), '@' (internal macros)
35 | [PR.PR_KEYWORD, /^\\[a-zA-Z@]+/],
36 | // or contains only one character
37 | [PR.PR_KEYWORD, /^\\./],
38 | // Highlight dollar for math mode and ampersam for tabular
39 | [PR.PR_TYPE, /^[$&]/],
40 | // numeric measurement values with attached units
41 | [PR.PR_LITERAL,
42 | /[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],
43 | // punctuation usually occurring within commands
44 | [PR.PR_PUNCTUATION, /^[{}()\[\]=]+/]
45 | ]),
46 | ['latex', 'tex']);
47 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-vb.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2009 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for various flavors of basic.
20 | *
21 | *
22 | * To use, include prettify.js and this file in your HTML page.
23 | * Then put your code in an HTML tag like
24 | *
25 | *
26 | *
27 | * http://msdn.microsoft.com/en-us/library/aa711638(VS.71).aspx defines the
28 | * visual basic grammar lexical grammar.
29 | *
30 | * @author mikesamuel@gmail.com
31 | */
32 |
33 | PR['registerLangHandler'](
34 | PR['createSimpleLexer'](
35 | [
36 | // Whitespace
37 | [PR['PR_PLAIN'], /^[\t\n\r \xA0\u2028\u2029]+/, null, '\t\n\r \xA0\u2028\u2029'],
38 | // A double quoted string with quotes escaped by doubling them.
39 | // A single character can be suffixed with C.
40 | [PR['PR_STRING'], /^(?:[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})(?:[\"\u201C\u201D]c|$)|[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})*(?:[\"\u201C\u201D]|$))/i, null,
41 | '"\u201C\u201D'],
42 | // A comment starts with a single quote and runs until the end of the
43 | // line.
44 | [PR['PR_COMMENT'], /^[\'\u2018\u2019][^\r\n\u2028\u2029]*/, null, '\'\u2018\u2019']
45 | ],
46 | [
47 | [PR['PR_KEYWORD'], /^(?:AddHandler|AddressOf|Alias|And|AndAlso|Ansi|As|Assembly|Auto|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|CShort|CSng|CStr|CType|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get|GetType|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|New|Next|Not|NotInheritable|NotOverridable|Object|On|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Preserve|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TypeOf|Unicode|Until|Variant|Wend|When|While|With|WithEvents|WriteOnly|Xor|EndIf|GoSub|Let|Variant|Wend)\b/i, null],
48 | // A second comment form
49 | [PR['PR_COMMENT'], /^REM[^\r\n\u2028\u2029]*/i],
50 | // A boolean, numeric, or date literal.
51 | [PR['PR_LITERAL'],
52 | /^(?:True\b|False\b|Nothing\b|\d+(?:E[+\-]?\d+[FRD]?|[FRDSIL])?|(?:&H[0-9A-F]+|&O[0-7]+)[SIL]?|\d*\.\d+(?:E[+\-]?\d+)?[FRD]?|#\s+(?:\d+[\-\/]\d+[\-\/]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)?|\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)\s+#)/i],
53 | // An identifier?
54 | [PR['PR_PLAIN'], /^(?:(?:[a-z]|_\w)\w*|\[(?:[a-z]|_\w)\w*\])/i],
55 | // A run of punctuation
56 | [PR['PR_PUNCTUATION'],
57 | /^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],
58 | // Square brackets
59 | [PR['PR_PUNCTUATION'], /^(?:\[|\])/]
60 | ]),
61 | ['vb', 'vbs']);
62 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-vhdl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @fileoverview
3 | * Registers a language handler for VHDL '93.
4 | *
5 | * Based on the lexical grammar and keywords at
6 | * http://www.iis.ee.ethz.ch/~zimmi/download/vhdl93_syntax.html
7 | *
8 | * @author benoit@ryder.fr
9 | */
10 |
11 | PR['registerLangHandler'](
12 | PR['createSimpleLexer'](
13 | [
14 | // Whitespace
15 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0']
16 | ],
17 | [
18 | // String, character or bit string
19 | [PR['PR_STRING'], /^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],
20 | // Comment, from two dashes until end of line.
21 | [PR['PR_COMMENT'], /^--[^\r\n]*/],
22 | [PR['PR_KEYWORD'], /^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, null],
23 | // Type, predefined or standard
24 | [PR['PR_TYPE'], /^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i, null],
25 | // Predefined attributes
26 | [PR['PR_TYPE'], /^\'(?:ACTIVE|ASCENDING|BASE|DELAYED|DRIVING|DRIVING_VALUE|EVENT|HIGH|IMAGE|INSTANCE_NAME|LAST_ACTIVE|LAST_EVENT|LAST_VALUE|LEFT|LEFTOF|LENGTH|LOW|PATH_NAME|POS|PRED|QUIET|RANGE|REVERSE_RANGE|RIGHT|RIGHTOF|SIMPLE_NAME|STABLE|SUCC|TRANSACTION|VAL|VALUE)(?=[^\w-]|$)/i, null],
27 | // Number, decimal or based literal
28 | [PR['PR_LITERAL'], /^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i],
29 | // Identifier, basic or extended
30 | [PR['PR_PLAIN'], /^(?:[a-z]\w*|\\[^\\]*\\)/i],
31 | // Punctuation
32 | [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0\-\"\']*/]
33 | ]),
34 | ['vhdl', 'vhd']);
35 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-wiki.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2009 Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | /**
17 | * @fileoverview
18 | * Registers a language handler for Wiki pages.
19 | *
20 | * Based on WikiSyntax at http://code.google.com/p/support/wiki/WikiSyntax
21 | *
22 | * @author mikesamuel@gmail.com
23 | */
24 |
25 | PR['registerLangHandler'](
26 | PR['createSimpleLexer'](
27 | [
28 | // Whitespace
29 | [PR['PR_PLAIN'], /^[\t \xA0a-gi-z0-9]+/, null,
30 | '\t \xA0abcdefgijklmnopqrstuvwxyz0123456789'],
31 | // Wiki formatting
32 | [PR['PR_PUNCTUATION'], /^[=*~\^\[\]]+/, null, '=*~^[]']
33 | ],
34 | [
35 | // Meta-info like #summary, #labels, etc.
36 | ['lang-wiki.meta', /(?:^^|\r\n?|\n)(#[a-z]+)\b/],
37 | // A WikiWord
38 | [PR['PR_LITERAL'], /^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/
39 | ],
40 | // A preformatted block in an unknown language
41 | ['lang-', /^\{\{\{([\s\S]+?)\}\}\}/],
42 | // A block of source code in an unknown language
43 | ['lang-', /^`([^\r\n`]+)`/],
44 | // An inline URL.
45 | [PR['PR_STRING'],
46 | /^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],
47 | [PR['PR_PLAIN'], /^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]
48 | ]),
49 | ['wiki']);
50 |
51 | PR['registerLangHandler'](
52 | PR['createSimpleLexer']([[PR['PR_KEYWORD'], /^#[a-z]+/i, null, '#']], []),
53 | ['wiki.meta']);
54 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-xq.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2011 Patrick Wied
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 |
17 | /**
18 | * @fileoverview
19 | * Registers a language handler for XQuery.
20 | *
21 | * To use, include prettify.js and this file in your HTML page.
22 | * Then put your code in an HTML tag like
23 | *
24 | *
25 | *
26 | * @author Patrick Wied ( patpa7p@live.de )
27 | * @version 2010-09-28
28 | */
29 |
30 | // Falls back to plain for stylesheets that don't style fun.
31 | var PR_FUNCTION = 'fun pln';
32 | // Falls back to plaiin for stylesheets that don't style var.
33 | var PR_VARIABLE = 'var pln';
34 |
35 | PR['registerLangHandler'](
36 | PR['createSimpleLexer'](
37 | [
38 | // Matching $var-ia_bles
39 | [PR_VARIABLE, /^\$[A-Za-z0-9_\-]+/, null, "$"]
40 | ],
41 | [
42 | // Matching lt and gt operators
43 | // Not the best matching solution but you have to differentiate between the gt operator and the tag closing char
44 | [PR['PR_PLAIN'], /^[\s=][<>][\s=]/],
45 | // Matching @Attributes
46 | [PR['PR_LITERAL'], /^\@[\w-]+/],
47 | // Matching xml tags
48 | [PR['PR_TAG'], /^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
49 | // Matching single or multiline xquery comments -> (: :)
50 | [PR['PR_COMMENT'], /^\(:[\s\S]*?:\)/],
51 | // Tokenizing /{}:=;*,[]() as plain
52 | [PR['PR_PLAIN'], /^[\/\{\};,\[\]\(\)]$/],
53 | // Matching a double or single quoted, possibly multi-line, string.
54 | // with the special condition that a { in a string changes to xquery context
55 | [PR['PR_STRING'], /^(?:\"(?:[^\"\\\{]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\\{]|\\[\s\S])*(?:\'|$))/, null, '"\''],
56 | // Matching standard xquery keywords
57 | [PR['PR_KEYWORD'], /^(?:xquery|where|version|variable|union|typeswitch|treat|to|then|text|stable|sortby|some|self|schema|satisfies|returns|return|ref|processing-instruction|preceding-sibling|preceding|precedes|parent|only|of|node|namespace|module|let|item|intersect|instance|in|import|if|function|for|follows|following-sibling|following|external|except|every|else|element|descending|descendant-or-self|descendant|define|default|declare|comment|child|cast|case|before|attribute|assert|ascending|as|ancestor-or-self|ancestor|after|eq|order|by|or|and|schema-element|document-node|node|at)\b/],
58 | // Matching standard xquery types
59 | [PR['PR_TYPE'], /^(?:xs:yearMonthDuration|xs:unsignedLong|xs:time|xs:string|xs:short|xs:QName|xs:Name|xs:long|xs:integer|xs:int|xs:gYearMonth|xs:gYear|xs:gMonthDay|xs:gDay|xs:float|xs:duration|xs:double|xs:decimal|xs:dayTimeDuration|xs:dateTime|xs:date|xs:byte|xs:boolean|xs:anyURI|xf:yearMonthDuration)\b/, null],
60 | // Matching standard xquery functions
61 | [PR_FUNCTION, /^(?:xp:dereference|xinc:node-expand|xinc:link-references|xinc:link-expand|xhtml:restructure|xhtml:clean|xhtml:add-lists|xdmp:zip-manifest|xdmp:zip-get|xdmp:zip-create|xdmp:xquery-version|xdmp:word-convert|xdmp:with-namespaces|xdmp:version|xdmp:value|xdmp:user-roles|xdmp:user-last-login|xdmp:user|xdmp:url-encode|xdmp:url-decode|xdmp:uri-is-file|xdmp:uri-format|xdmp:uri-content-type|xdmp:unquote|xdmp:unpath|xdmp:triggers-database|xdmp:trace|xdmp:to-json|xdmp:tidy|xdmp:subbinary|xdmp:strftime|xdmp:spawn-in|xdmp:spawn|xdmp:sleep|xdmp:shutdown|xdmp:set-session-field|xdmp:set-response-encoding|xdmp:set-response-content-type|xdmp:set-response-code|xdmp:set-request-time-limit|xdmp:set|xdmp:servers|xdmp:server-status|xdmp:server-name|xdmp:server|xdmp:security-database|xdmp:security-assert|xdmp:schema-database|xdmp:save|xdmp:role-roles|xdmp:role|xdmp:rethrow|xdmp:restart|xdmp:request-timestamp|xdmp:request-status|xdmp:request-cancel|xdmp:request|xdmp:redirect-response|xdmp:random|xdmp:quote|xdmp:query-trace|xdmp:query-meters|xdmp:product-edition|xdmp:privilege-roles|xdmp:privilege|xdmp:pretty-print|xdmp:powerpoint-convert|xdmp:platform|xdmp:permission|xdmp:pdf-convert|xdmp:path|xdmp:octal-to-integer|xdmp:node-uri|xdmp:node-replace|xdmp:node-kind|xdmp:node-insert-child|xdmp:node-insert-before|xdmp:node-insert-after|xdmp:node-delete|xdmp:node-database|xdmp:mul64|xdmp:modules-root|xdmp:modules-database|xdmp:merging|xdmp:merge-cancel|xdmp:merge|xdmp:md5|xdmp:logout|xdmp:login|xdmp:log-level|xdmp:log|xdmp:lock-release|xdmp:lock-acquire|xdmp:load|xdmp:invoke-in|xdmp:invoke|xdmp:integer-to-octal|xdmp:integer-to-hex|xdmp:http-put|xdmp:http-post|xdmp:http-options|xdmp:http-head|xdmp:http-get|xdmp:http-delete|xdmp:hosts|xdmp:host-status|xdmp:host-name|xdmp:host|xdmp:hex-to-integer|xdmp:hash64|xdmp:hash32|xdmp:has-privilege|xdmp:groups|xdmp:group-serves|xdmp:group-servers|xdmp:group-name|xdmp:group-hosts|xdmp:group|xdmp:get-session-field-names|xdmp:get-session-field|xdmp:get-response-encoding|xdmp:get-response-code|xdmp:get-request-username|xdmp:get-request-user|xdmp:get-request-url|xdmp:get-request-protocol|xdmp:get-request-path|xdmp:get-request-method|xdmp:get-request-header-names|xdmp:get-request-header|xdmp:get-request-field-names|xdmp:get-request-field-filename|xdmp:get-request-field-content-type|xdmp:get-request-field|xdmp:get-request-client-certificate|xdmp:get-request-client-address|xdmp:get-request-body|xdmp:get-current-user|xdmp:get-current-roles|xdmp:get|xdmp:function-name|xdmp:function-module|xdmp:function|xdmp:from-json|xdmp:forests|xdmp:forest-status|xdmp:forest-restore|xdmp:forest-restart|xdmp:forest-name|xdmp:forest-delete|xdmp:forest-databases|xdmp:forest-counts|xdmp:forest-clear|xdmp:forest-backup|xdmp:forest|xdmp:filesystem-file|xdmp:filesystem-directory|xdmp:exists|xdmp:excel-convert|xdmp:eval-in|xdmp:eval|xdmp:estimate|xdmp:email|xdmp:element-content-type|xdmp:elapsed-time|xdmp:document-set-quality|xdmp:document-set-property|xdmp:document-set-properties|xdmp:document-set-permissions|xdmp:document-set-collections|xdmp:document-remove-properties|xdmp:document-remove-permissions|xdmp:document-remove-collections|xdmp:document-properties|xdmp:document-locks|xdmp:document-load|xdmp:document-insert|xdmp:document-get-quality|xdmp:document-get-properties|xdmp:document-get-permissions|xdmp:document-get-collections|xdmp:document-get|xdmp:document-forest|xdmp:document-delete|xdmp:document-add-properties|xdmp:document-add-permissions|xdmp:document-add-collections|xdmp:directory-properties|xdmp:directory-locks|xdmp:directory-delete|xdmp:directory-create|xdmp:directory|xdmp:diacritic-less|xdmp:describe|xdmp:default-permissions|xdmp:default-collections|xdmp:databases|xdmp:database-restore-validate|xdmp:database-restore-status|xdmp:database-restore-cancel|xdmp:database-restore|xdmp:database-name|xdmp:database-forests|xdmp:database-backup-validate|xdmp:database-backup-status|xdmp:database-backup-purge|xdmp:database-backup-cancel|xdmp:database-backup|xdmp:database|xdmp:collection-properties|xdmp:collection-locks|xdmp:collection-delete|xdmp:collation-canonical-uri|xdmp:castable-as|xdmp:can-grant-roles|xdmp:base64-encode|xdmp:base64-decode|xdmp:architecture|xdmp:apply|xdmp:amp-roles|xdmp:amp|xdmp:add64|xdmp:add-response-header|xdmp:access|trgr:trigger-set-recursive|trgr:trigger-set-permissions|trgr:trigger-set-name|trgr:trigger-set-module|trgr:trigger-set-event|trgr:trigger-set-description|trgr:trigger-remove-permissions|trgr:trigger-module|trgr:trigger-get-permissions|trgr:trigger-enable|trgr:trigger-disable|trgr:trigger-database-online-event|trgr:trigger-data-event|trgr:trigger-add-permissions|trgr:remove-trigger|trgr:property-content|trgr:pre-commit|trgr:post-commit|trgr:get-trigger-by-id|trgr:get-trigger|trgr:document-scope|trgr:document-content|trgr:directory-scope|trgr:create-trigger|trgr:collection-scope|trgr:any-property-content|thsr:set-entry|thsr:remove-term|thsr:remove-synonym|thsr:remove-entry|thsr:query-lookup|thsr:lookup|thsr:load|thsr:insert|thsr:expand|thsr:add-synonym|spell:suggest-detailed|spell:suggest|spell:remove-word|spell:make-dictionary|spell:load|spell:levenshtein-distance|spell:is-correct|spell:insert|spell:double-metaphone|spell:add-word|sec:users-collection|sec:user-set-roles|sec:user-set-password|sec:user-set-name|sec:user-set-description|sec:user-set-default-permissions|sec:user-set-default-collections|sec:user-remove-roles|sec:user-privileges|sec:user-get-roles|sec:user-get-description|sec:user-get-default-permissions|sec:user-get-default-collections|sec:user-doc-permissions|sec:user-doc-collections|sec:user-add-roles|sec:unprotect-collection|sec:uid-for-name|sec:set-realm|sec:security-version|sec:security-namespace|sec:security-installed|sec:security-collection|sec:roles-collection|sec:role-set-roles|sec:role-set-name|sec:role-set-description|sec:role-set-default-permissions|sec:role-set-default-collections|sec:role-remove-roles|sec:role-privileges|sec:role-get-roles|sec:role-get-description|sec:role-get-default-permissions|sec:role-get-default-collections|sec:role-doc-permissions|sec:role-doc-collections|sec:role-add-roles|sec:remove-user|sec:remove-role-from-users|sec:remove-role-from-role|sec:remove-role-from-privileges|sec:remove-role-from-amps|sec:remove-role|sec:remove-privilege|sec:remove-amp|sec:protect-collection|sec:privileges-collection|sec:privilege-set-roles|sec:privilege-set-name|sec:privilege-remove-roles|sec:privilege-get-roles|sec:privilege-add-roles|sec:priv-doc-permissions|sec:priv-doc-collections|sec:get-user-names|sec:get-unique-elem-id|sec:get-role-names|sec:get-role-ids|sec:get-privilege|sec:get-distinct-permissions|sec:get-collection|sec:get-amp|sec:create-user-with-role|sec:create-user|sec:create-role|sec:create-privilege|sec:create-amp|sec:collections-collection|sec:collection-set-permissions|sec:collection-remove-permissions|sec:collection-get-permissions|sec:collection-add-permissions|sec:check-admin|sec:amps-collection|sec:amp-set-roles|sec:amp-remove-roles|sec:amp-get-roles|sec:amp-doc-permissions|sec:amp-doc-collections|sec:amp-add-roles|search:unparse|search:suggest|search:snippet|search:search|search:resolve-nodes|search:resolve|search:remove-constraint|search:parse|search:get-default-options|search:estimate|search:check-options|prof:value|prof:reset|prof:report|prof:invoke|prof:eval|prof:enable|prof:disable|prof:allowed|ppt:clean|pki:template-set-request|pki:template-set-name|pki:template-set-key-type|pki:template-set-key-options|pki:template-set-description|pki:template-in-use|pki:template-get-version|pki:template-get-request|pki:template-get-name|pki:template-get-key-type|pki:template-get-key-options|pki:template-get-id|pki:template-get-description|pki:need-certificate|pki:is-temporary|pki:insert-trusted-certificates|pki:insert-template|pki:insert-signed-certificates|pki:insert-certificate-revocation-list|pki:get-trusted-certificate-ids|pki:get-template-ids|pki:get-template-certificate-authority|pki:get-template-by-name|pki:get-template|pki:get-pending-certificate-requests-xml|pki:get-pending-certificate-requests-pem|pki:get-pending-certificate-request|pki:get-certificates-for-template-xml|pki:get-certificates-for-template|pki:get-certificates|pki:get-certificate-xml|pki:get-certificate-pem|pki:get-certificate|pki:generate-temporary-certificate-if-necessary|pki:generate-temporary-certificate|pki:generate-template-certificate-authority|pki:generate-certificate-request|pki:delete-template|pki:delete-certificate|pki:create-template|pdf:make-toc|pdf:insert-toc-headers|pdf:get-toc|pdf:clean|p:status-transition|p:state-transition|p:remove|p:pipelines|p:insert|p:get-by-id|p:get|p:execute|p:create|p:condition|p:collection|p:action|ooxml:runs-merge|ooxml:package-uris|ooxml:package-parts-insert|ooxml:package-parts|msword:clean|mcgm:polygon|mcgm:point|mcgm:geospatial-query-from-elements|mcgm:geospatial-query|mcgm:circle|math:tanh|math:tan|math:sqrt|math:sinh|math:sin|math:pow|math:modf|math:log10|math:log|math:ldexp|math:frexp|math:fmod|math:floor|math:fabs|math:exp|math:cosh|math:cos|math:ceil|math:atan2|math:atan|math:asin|math:acos|map:put|map:map|map:keys|map:get|map:delete|map:count|map:clear|lnk:to|lnk:remove|lnk:insert|lnk:get|lnk:from|lnk:create|kml:polygon|kml:point|kml:interior-polygon|kml:geospatial-query-from-elements|kml:geospatial-query|kml:circle|kml:box|gml:polygon|gml:point|gml:interior-polygon|gml:geospatial-query-from-elements|gml:geospatial-query|gml:circle|gml:box|georss:point|georss:geospatial-query|georss:circle|geo:polygon|geo:point|geo:interior-polygon|geo:geospatial-query-from-elements|geo:geospatial-query|geo:circle|geo:box|fn:zero-or-one|fn:years-from-duration|fn:year-from-dateTime|fn:year-from-date|fn:upper-case|fn:unordered|fn:true|fn:translate|fn:trace|fn:tokenize|fn:timezone-from-time|fn:timezone-from-dateTime|fn:timezone-from-date|fn:sum|fn:subtract-dateTimes-yielding-yearMonthDuration|fn:subtract-dateTimes-yielding-dayTimeDuration|fn:substring-before|fn:substring-after|fn:substring|fn:subsequence|fn:string-to-codepoints|fn:string-pad|fn:string-length|fn:string-join|fn:string|fn:static-base-uri|fn:starts-with|fn:seconds-from-time|fn:seconds-from-duration|fn:seconds-from-dateTime|fn:round-half-to-even|fn:round|fn:root|fn:reverse|fn:resolve-uri|fn:resolve-QName|fn:replace|fn:remove|fn:QName|fn:prefix-from-QName|fn:position|fn:one-or-more|fn:number|fn:not|fn:normalize-unicode|fn:normalize-space|fn:node-name|fn:node-kind|fn:nilled|fn:namespace-uri-from-QName|fn:namespace-uri-for-prefix|fn:namespace-uri|fn:name|fn:months-from-duration|fn:month-from-dateTime|fn:month-from-date|fn:minutes-from-time|fn:minutes-from-duration|fn:minutes-from-dateTime|fn:min|fn:max|fn:matches|fn:lower-case|fn:local-name-from-QName|fn:local-name|fn:last|fn:lang|fn:iri-to-uri|fn:insert-before|fn:index-of|fn:in-scope-prefixes|fn:implicit-timezone|fn:idref|fn:id|fn:hours-from-time|fn:hours-from-duration|fn:hours-from-dateTime|fn:floor|fn:false|fn:expanded-QName|fn:exists|fn:exactly-one|fn:escape-uri|fn:escape-html-uri|fn:error|fn:ends-with|fn:encode-for-uri|fn:empty|fn:document-uri|fn:doc-available|fn:doc|fn:distinct-values|fn:distinct-nodes|fn:default-collation|fn:deep-equal|fn:days-from-duration|fn:day-from-dateTime|fn:day-from-date|fn:data|fn:current-time|fn:current-dateTime|fn:current-date|fn:count|fn:contains|fn:concat|fn:compare|fn:collection|fn:codepoints-to-string|fn:codepoint-equal|fn:ceiling|fn:boolean|fn:base-uri|fn:avg|fn:adjust-time-to-timezone|fn:adjust-dateTime-to-timezone|fn:adjust-date-to-timezone|fn:abs|feed:unsubscribe|feed:subscription|feed:subscribe|feed:request|feed:item|feed:description|excel:clean|entity:enrich|dom:set-pipelines|dom:set-permissions|dom:set-name|dom:set-evaluation-context|dom:set-domain-scope|dom:set-description|dom:remove-pipeline|dom:remove-permissions|dom:remove|dom:get|dom:evaluation-context|dom:domains|dom:domain-scope|dom:create|dom:configuration-set-restart-user|dom:configuration-set-permissions|dom:configuration-set-evaluation-context|dom:configuration-set-default-domain|dom:configuration-get|dom:configuration-create|dom:collection|dom:add-pipeline|dom:add-permissions|dls:retention-rules|dls:retention-rule-remove|dls:retention-rule-insert|dls:retention-rule|dls:purge|dls:node-expand|dls:link-references|dls:link-expand|dls:documents-query|dls:document-versions-query|dls:document-version-uri|dls:document-version-query|dls:document-version-delete|dls:document-version-as-of|dls:document-version|dls:document-update|dls:document-unmanage|dls:document-set-quality|dls:document-set-property|dls:document-set-properties|dls:document-set-permissions|dls:document-set-collections|dls:document-retention-rules|dls:document-remove-properties|dls:document-remove-permissions|dls:document-remove-collections|dls:document-purge|dls:document-manage|dls:document-is-managed|dls:document-insert-and-manage|dls:document-include-query|dls:document-history|dls:document-get-permissions|dls:document-extract-part|dls:document-delete|dls:document-checkout-status|dls:document-checkout|dls:document-checkin|dls:document-add-properties|dls:document-add-permissions|dls:document-add-collections|dls:break-checkout|dls:author-query|dls:as-of-query|dbk:convert|dbg:wait|dbg:value|dbg:stopped|dbg:stop|dbg:step|dbg:status|dbg:stack|dbg:out|dbg:next|dbg:line|dbg:invoke|dbg:function|dbg:finish|dbg:expr|dbg:eval|dbg:disconnect|dbg:detach|dbg:continue|dbg:connect|dbg:clear|dbg:breakpoints|dbg:break|dbg:attached|dbg:attach|cvt:save-converted-documents|cvt:part-uri|cvt:destination-uri|cvt:basepath|cvt:basename|cts:words|cts:word-query-weight|cts:word-query-text|cts:word-query-options|cts:word-query|cts:word-match|cts:walk|cts:uris|cts:uri-match|cts:train|cts:tokenize|cts:thresholds|cts:stem|cts:similar-query-weight|cts:similar-query-nodes|cts:similar-query|cts:shortest-distance|cts:search|cts:score|cts:reverse-query-weight|cts:reverse-query-nodes|cts:reverse-query|cts:remainder|cts:registered-query-weight|cts:registered-query-options|cts:registered-query-ids|cts:registered-query|cts:register|cts:query|cts:quality|cts:properties-query-query|cts:properties-query|cts:polygon-vertices|cts:polygon|cts:point-longitude|cts:point-latitude|cts:point|cts:or-query-queries|cts:or-query|cts:not-query-weight|cts:not-query-query|cts:not-query|cts:near-query-weight|cts:near-query-queries|cts:near-query-options|cts:near-query-distance|cts:near-query|cts:highlight|cts:geospatial-co-occurrences|cts:frequency|cts:fitness|cts:field-words|cts:field-word-query-weight|cts:field-word-query-text|cts:field-word-query-options|cts:field-word-query-field-name|cts:field-word-query|cts:field-word-match|cts:entity-highlight|cts:element-words|cts:element-word-query-weight|cts:element-word-query-text|cts:element-word-query-options|cts:element-word-query-element-name|cts:element-word-query|cts:element-word-match|cts:element-values|cts:element-value-ranges|cts:element-value-query-weight|cts:element-value-query-text|cts:element-value-query-options|cts:element-value-query-element-name|cts:element-value-query|cts:element-value-match|cts:element-value-geospatial-co-occurrences|cts:element-value-co-occurrences|cts:element-range-query-weight|cts:element-range-query-value|cts:element-range-query-options|cts:element-range-query-operator|cts:element-range-query-element-name|cts:element-range-query|cts:element-query-query|cts:element-query-element-name|cts:element-query|cts:element-pair-geospatial-values|cts:element-pair-geospatial-value-match|cts:element-pair-geospatial-query-weight|cts:element-pair-geospatial-query-region|cts:element-pair-geospatial-query-options|cts:element-pair-geospatial-query-longitude-name|cts:element-pair-geospatial-query-latitude-name|cts:element-pair-geospatial-query-element-name|cts:element-pair-geospatial-query|cts:element-pair-geospatial-boxes|cts:element-geospatial-values|cts:element-geospatial-value-match|cts:element-geospatial-query-weight|cts:element-geospatial-query-region|cts:element-geospatial-query-options|cts:element-geospatial-query-element-name|cts:element-geospatial-query|cts:element-geospatial-boxes|cts:element-child-geospatial-values|cts:element-child-geospatial-value-match|cts:element-child-geospatial-query-weight|cts:element-child-geospatial-query-region|cts:element-child-geospatial-query-options|cts:element-child-geospatial-query-element-name|cts:element-child-geospatial-query-child-name|cts:element-child-geospatial-query|cts:element-child-geospatial-boxes|cts:element-attribute-words|cts:element-attribute-word-query-weight|cts:element-attribute-word-query-text|cts:element-attribute-word-query-options|cts:element-attribute-word-query-element-name|cts:element-attribute-word-query-attribute-name|cts:element-attribute-word-query|cts:element-attribute-word-match|cts:element-attribute-values|cts:element-attribute-value-ranges|cts:element-attribute-value-query-weight|cts:element-attribute-value-query-text|cts:element-attribute-value-query-options|cts:element-attribute-value-query-element-name|cts:element-attribute-value-query-attribute-name|cts:element-attribute-value-query|cts:element-attribute-value-match|cts:element-attribute-value-geospatial-co-occurrences|cts:element-attribute-value-co-occurrences|cts:element-attribute-range-query-weight|cts:element-attribute-range-query-value|cts:element-attribute-range-query-options|cts:element-attribute-range-query-operator|cts:element-attribute-range-query-element-name|cts:element-attribute-range-query-attribute-name|cts:element-attribute-range-query|cts:element-attribute-pair-geospatial-values|cts:element-attribute-pair-geospatial-value-match|cts:element-attribute-pair-geospatial-query-weight|cts:element-attribute-pair-geospatial-query-region|cts:element-attribute-pair-geospatial-query-options|cts:element-attribute-pair-geospatial-query-longitude-name|cts:element-attribute-pair-geospatial-query-latitude-name|cts:element-attribute-pair-geospatial-query-element-name|cts:element-attribute-pair-geospatial-query|cts:element-attribute-pair-geospatial-boxes|cts:document-query-uris|cts:document-query|cts:distance|cts:directory-query-uris|cts:directory-query-depth|cts:directory-query|cts:destination|cts:deregister|cts:contains|cts:confidence|cts:collections|cts:collection-query-uris|cts:collection-query|cts:collection-match|cts:classify|cts:circle-radius|cts:circle-center|cts:circle|cts:box-west|cts:box-south|cts:box-north|cts:box-east|cts:box|cts:bearing|cts:arc-intersection|cts:and-query-queries|cts:and-query-options|cts:and-query|cts:and-not-query-positive-query|cts:and-not-query-negative-query|cts:and-not-query|css:get|css:convert|cpf:success|cpf:failure|cpf:document-set-state|cpf:document-set-processing-status|cpf:document-set-last-updated|cpf:document-set-error|cpf:document-get-state|cpf:document-get-processing-status|cpf:document-get-last-updated|cpf:document-get-error|cpf:check-transition|alert:spawn-matching-actions|alert:rule-user-id-query|alert:rule-set-user-id|alert:rule-set-query|alert:rule-set-options|alert:rule-set-name|alert:rule-set-description|alert:rule-set-action|alert:rule-remove|alert:rule-name-query|alert:rule-insert|alert:rule-id-query|alert:rule-get-user-id|alert:rule-get-query|alert:rule-get-options|alert:rule-get-name|alert:rule-get-id|alert:rule-get-description|alert:rule-get-action|alert:rule-action-query|alert:remove-triggers|alert:make-rule|alert:make-log-action|alert:make-config|alert:make-action|alert:invoke-matching-actions|alert:get-my-rules|alert:get-all-rules|alert:get-actions|alert:find-matching-rules|alert:create-triggers|alert:config-set-uri|alert:config-set-trigger-ids|alert:config-set-options|alert:config-set-name|alert:config-set-description|alert:config-set-cpf-domain-names|alert:config-set-cpf-domain-ids|alert:config-insert|alert:config-get-uri|alert:config-get-trigger-ids|alert:config-get-options|alert:config-get-name|alert:config-get-id|alert:config-get-description|alert:config-get-cpf-domain-names|alert:config-get-cpf-domain-ids|alert:config-get|alert:config-delete|alert:action-set-options|alert:action-set-name|alert:action-set-module-root|alert:action-set-module-db|alert:action-set-module|alert:action-set-description|alert:action-remove|alert:action-insert|alert:action-get-options|alert:action-get-name|alert:action-get-module-root|alert:action-get-module-db|alert:action-get-module|alert:action-get-description|zero-or-one|years-from-duration|year-from-dateTime|year-from-date|upper-case|unordered|true|translate|trace|tokenize|timezone-from-time|timezone-from-dateTime|timezone-from-date|sum|subtract-dateTimes-yielding-yearMonthDuration|subtract-dateTimes-yielding-dayTimeDuration|substring-before|substring-after|substring|subsequence|string-to-codepoints|string-pad|string-length|string-join|string|static-base-uri|starts-with|seconds-from-time|seconds-from-duration|seconds-from-dateTime|round-half-to-even|round|root|reverse|resolve-uri|resolve-QName|replace|remove|QName|prefix-from-QName|position|one-or-more|number|not|normalize-unicode|normalize-space|node-name|node-kind|nilled|namespace-uri-from-QName|namespace-uri-for-prefix|namespace-uri|name|months-from-duration|month-from-dateTime|month-from-date|minutes-from-time|minutes-from-duration|minutes-from-dateTime|min|max|matches|lower-case|local-name-from-QName|local-name|last|lang|iri-to-uri|insert-before|index-of|in-scope-prefixes|implicit-timezone|idref|id|hours-from-time|hours-from-duration|hours-from-dateTime|floor|false|expanded-QName|exists|exactly-one|escape-uri|escape-html-uri|error|ends-with|encode-for-uri|empty|document-uri|doc-available|doc|distinct-values|distinct-nodes|default-collation|deep-equal|days-from-duration|day-from-dateTime|day-from-date|data|current-time|current-dateTime|current-date|count|contains|concat|compare|collection|codepoints-to-string|codepoint-equal|ceiling|boolean|base-uri|avg|adjust-time-to-timezone|adjust-dateTime-to-timezone|adjust-date-to-timezone|abs)\b/],
62 | // Matching normal words if none of the previous regular expressions matched
63 | [PR['PR_PLAIN'], /^[A-Za-z0-9_\-\:]+/],
64 | // Matching whitespaces
65 | [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/]
66 | ]),
67 | ['xq', 'xquery']);
68 |
--------------------------------------------------------------------------------
/third-party/prettify/lang-yaml.js:
--------------------------------------------------------------------------------
1 | // Contributed by ribrdb @ code.google.com
2 |
3 | /**
4 | * @fileoverview
5 | * Registers a language handler for YAML.
6 | *
7 | * @author ribrdb
8 | */
9 |
10 | PR['registerLangHandler'](
11 | PR['createSimpleLexer'](
12 | [
13 | [PR['PR_PUNCTUATION'], /^[:|>?]+/, null, ':|>?'],
14 | [PR['PR_DECLARATION'], /^%(?:YAML|TAG)[^#\r\n]+/, null, '%'],
15 | [PR['PR_TYPE'], /^[&]\S+/, null, '&'],
16 | [PR['PR_TYPE'], /^!\S*/, null, '!'],
17 | [PR['PR_STRING'], /^"(?:[^\\"]|\\.)*(?:"|$)/, null, '"'],
18 | [PR['PR_STRING'], /^'(?:[^']|'')*(?:'|$)/, null, "'"],
19 | [PR['PR_COMMENT'], /^#[^\r\n]*/, null, '#'],
20 | [PR['PR_PLAIN'], /^\s+/, null, ' \t\r\n']
21 | ],
22 | [
23 | [PR['PR_DECLARATION'], /^(?:---|\.\.\.)(?:[\r\n]|$)/],
24 | [PR['PR_PUNCTUATION'], /^-/],
25 | [PR['PR_KEYWORD'], /^\w+:[ \r\n]/],
26 | [PR['PR_PLAIN'], /^\w+/]
27 | ]), ['yaml', 'yml']);
28 |
--------------------------------------------------------------------------------
/third-party/prettify/prettify.css:
--------------------------------------------------------------------------------
1 | /* Pretty printing styles. Used with prettify.js. */
2 |
3 | /* SPAN elements with the classes below are added by prettyprint. */
4 | .pln { color: #000 } /* plain text */
5 |
6 | @media screen {
7 | .str { color: #080 } /* string content */
8 | .kwd { color: #008 } /* a keyword */
9 | .com { color: #800 } /* a comment */
10 | .typ { color: #606 } /* a type name */
11 | .lit { color: #066 } /* a literal value */
12 | /* punctuation, lisp open bracket, lisp close bracket */
13 | .pun, .opn, .clo { color: #660 }
14 | .tag { color: #008 } /* a markup tag name */
15 | .atn { color: #606 } /* a markup attribute name */
16 | .atv { color: #080 } /* a markup attribute value */
17 | .dec, .var { color: #606 } /* a declaration; a variable name */
18 | .fun { color: red } /* a function name */
19 | }
20 |
21 | /* Use higher contrast and text-weight for printable form. */
22 | @media print, projection {
23 | .str { color: #060 }
24 | .kwd { color: #006; font-weight: bold }
25 | .com { color: #600; font-style: italic }
26 | .typ { color: #404; font-weight: bold }
27 | .lit { color: #044 }
28 | .pun, .opn, .clo { color: #440 }
29 | .tag { color: #006; font-weight: bold }
30 | .atn { color: #404 }
31 | .atv { color: #060 }
32 | }
33 |
34 | /* Put a border around prettyprinted code snippets. */
35 | pre.prettyprint { padding: 2px; border: 1px solid #888 }
36 |
37 | /* Specify class=linenums on a pre to get line numbering */
38 | ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
39 | li.L0,
40 | li.L1,
41 | li.L2,
42 | li.L3,
43 | li.L5,
44 | li.L6,
45 | li.L7,
46 | li.L8 { list-style-type: none }
47 | /* Alternate shading for lines */
48 | li.L1,
49 | li.L3,
50 | li.L5,
51 | li.L7,
52 | li.L9 { background: #eee }
53 |
--------------------------------------------------------------------------------
/third-party/require.js:
--------------------------------------------------------------------------------
1 | /*
2 | RequireJS 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3 | Available via the MIT or new BSD license.
4 | see: http://github.com/jrburke/requirejs for details
5 | */
6 | var requirejs,require,define;
7 | (function(Y){function x(b){return J.call(b)==="[object Function]"}function G(b){return J.call(b)==="[object Array]"}function q(b,c){if(b){var e;for(e=0;e-1;e-=1)if(b[e]&&c(b[e],e,b))break}}function y(b,c){for(var e in b)if(b.hasOwnProperty(e)&&c(b[e],e))break}function K(b,c,e,i){c&&y(c,function(c,j){if(e||!b.hasOwnProperty(j))i&&typeof c!=="string"?(b[j]||(b[j]={}),K(b[j],c,e,i)):b[j]=c});return b}function s(b,
8 | c){return function(){return c.apply(b,arguments)}}function Z(b){if(!b)return b;var c=Y;q(b.split("."),function(b){c=c[b]});return c}function $(b,c,e){return function(){var i=fa.call(arguments,0),g;if(e&&x(g=i[i.length-1]))g.__requireJsBuild=!0;i.push(c);return b.apply(null,i)}}function aa(b,c,e){q([["toUrl"],["undef"],["defined","requireDefined"],["specified","requireSpecified"]],function(i){var g=i[1]||i[0];b[i[0]]=c?$(c[g],e):function(){var b=z[O];return b[g].apply(b,arguments)}})}function H(b,
9 | c,e,i){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=i;if(e)c.originalError=e;return c}function ga(){if(I&&I.readyState==="interactive")return I;N(document.getElementsByTagName("script"),function(b){if(b.readyState==="interactive")return I=b});return I}var ha=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ia=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,ba=/\.js$/,ja=/^\.\//,J=Object.prototype.toString,A=Array.prototype,fa=A.slice,ka=A.splice,w=!!(typeof window!==
10 | "undefined"&&navigator&&document),ca=!w&&typeof importScripts!=="undefined",la=w&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,O="_",S=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",z={},p={},P=[],L=!1,j,t,C,u,D,I,E,da,ea;if(typeof define==="undefined"){if(typeof requirejs!=="undefined"){if(x(requirejs))return;p=requirejs;requirejs=void 0}typeof require!=="undefined"&&!x(require)&&(p=require,require=void 0);j=requirejs=function(b,c,e,i){var g=O,r;!G(b)&&
11 | typeof b!=="string"&&(r=b,G(c)?(b=c,c=e,e=i):b=[]);if(r&&r.context)g=r.context;(i=z[g])||(i=z[g]=j.s.newContext(g));r&&i.configure(r);return i.require(b,c,e)};j.config=function(b){return j(b)};require||(require=j);j.version="2.0.4";j.jsExtRegExp=/^\/|:|\?|\.js$/;j.isBrowser=w;A=j.s={contexts:z,newContext:function(b){function c(a,d,o){var l=d&&d.split("/"),f=l,b=k.map,c=b&&b["*"],e,g,h;if(a&&a.charAt(0)===".")if(d){f=k.pkgs[d]?l=[d]:l.slice(0,l.length-1);d=a=f.concat(a.split("/"));for(f=0;d[f];f+=
12 | 1)if(e=d[f],e===".")d.splice(f,1),f-=1;else if(e==="..")if(f===1&&(d[2]===".."||d[0]===".."))break;else f>0&&(d.splice(f-1,2),f-=2);f=k.pkgs[d=a[0]];a=a.join("/");f&&a===d+"/"+f.main&&(a=d)}else a.indexOf("./")===0&&(a=a.substring(2));if(o&&(l||c)&&b){d=a.split("/");for(f=d.length;f>0;f-=1){g=d.slice(0,f).join("/");if(l)for(e=l.length;e>0;e-=1)if(o=b[l.slice(0,e).join("/")])if(o=o[g]){h=o;break}!h&&c&&c[g]&&(h=c[g]);if(h){d.splice(0,f,h);a=d.join("/");break}}}return a}function e(a){w&&q(document.getElementsByTagName("script"),
13 | function(d){if(d.getAttribute("data-requiremodule")===a&&d.getAttribute("data-requirecontext")===h.contextName)return d.parentNode.removeChild(d),!0})}function i(a){var d=k.paths[a];if(d&&G(d)&&d.length>1)return e(a),d.shift(),h.undef(a),h.require([a]),!0}function g(a,d,o,b){var f=a?a.indexOf("!"):-1,v=null,e=d?d.name:null,g=a,i=!0,j="",k,m;a||(i=!1,a="_@r"+(N+=1));f!==-1&&(v=a.substring(0,f),a=a.substring(f+1,a.length));v&&(v=c(v,e,b),m=n[v]);a&&(v?j=m&&m.normalize?m.normalize(a,function(a){return c(a,
14 | e,b)}):c(a,e,b):(j=c(a,e,b),k=h.nameToUrl(j)));a=v&&!m&&!o?"_unnormalized"+(O+=1):"";return{prefix:v,name:j,parentMap:d,unnormalized:!!a,url:k,originalName:g,isDefine:i,id:(v?v+"!"+j:j)+a}}function r(a){var d=a.id,o=m[d];o||(o=m[d]=new h.Module(a));return o}function p(a,d,o){var b=a.id,f=m[b];if(n.hasOwnProperty(b)&&(!f||f.defineEmitComplete))d==="defined"&&o(n[b]);else r(a).on(d,o)}function B(a,d){var b=a.requireModules,l=!1;if(d)d(a);else if(q(b,function(d){if(d=m[d])d.error=a,d.events.error&&(l=
15 | !0,d.emit("error",a))}),!l)j.onError(a)}function u(){P.length&&(ka.apply(F,[F.length-1,0].concat(P)),P=[])}function t(a,d,b){a=a&&a.map;d=$(b||h.require,a,d);aa(d,h,a);d.isBrowser=w;return d}function z(a){delete m[a];q(M,function(d,b){if(d.map.id===a)return M.splice(b,1),d.defined||(h.waitCount-=1),!0})}function A(a,d){var b=a.map.id,l=a.depMaps,f;if(a.inited){if(d[b])return a;d[b]=!0;q(l,function(a){if(a=m[a.id])return!a.inited||!a.enabled?(f=null,delete d[b],!0):f=A(a,K({},d))});return f}}function C(a,
16 | d,b){var l=a.map.id,f=a.depMaps;if(a.inited&&a.map.isDefine){if(d[l])return n[l];d[l]=a;q(f,function(f){var f=f.id,c=m[f];!Q[f]&&c&&(!c.inited||!c.enabled?b[l]=!0:(c=C(c,d,b),b[f]||a.defineDepById(f,c)))});a.check(!0);return n[l]}}function D(a){a.check()}function E(){var a=k.waitSeconds*1E3,d=a&&h.startTime+a<(new Date).getTime(),b=[],l=!1,f=!0,c,g,j;if(!T){T=!0;y(m,function(a){c=a.map;g=c.id;if(a.enabled&&!a.error)if(!a.inited&&d)i(g)?l=j=!0:(b.push(g),e(g));else if(!a.inited&&a.fetched&&c.isDefine&&
17 | (l=!0,!c.prefix))return f=!1});if(d&&b.length)return a=H("timeout","Load timeout for modules: "+b,null,b),a.contextName=h.contextName,B(a);f&&(q(M,function(a){if(!a.defined){var a=A(a,{}),d={};a&&(C(a,d,{}),y(d,D))}}),y(m,D));if((!d||j)&&l)if((w||ca)&&!U)U=setTimeout(function(){U=0;E()},50);T=!1}}function V(a){r(g(a[0],null,!0)).init(a[1],a[2])}function J(a){var a=a.currentTarget||a.srcElement,d=h.onScriptLoad;a.detachEvent&&!S?a.detachEvent("onreadystatechange",d):a.removeEventListener("load",d,
18 | !1);d=h.onScriptError;a.detachEvent&&!S||a.removeEventListener("error",d,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}var k={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{}},m={},W={},F=[],n={},R={},N=1,O=1,M=[],T,X,h,Q,U;Q={require:function(a){return t(a)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports=n[a.map.id]={}},module:function(a){return a.module={id:a.map.id,uri:a.map.url,config:function(){return k.config&&k.config[a.map.id]||{}},exports:n[a.map.id]}}};
19 | X=function(a){this.events=W[a.id]||{};this.map=a;this.shim=k.shim[a.id];this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};X.prototype={init:function(a,d,b,l){l=l||{};if(!this.inited){this.factory=d;if(b)this.on("error",b);else this.events.error&&(b=s(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.depMaps.rjsSkipMap=a.rjsSkipMap;this.errback=b;this.inited=!0;this.ignore=l.ignore;l.enabled||this.enabled?this.enable():this.check()}},defineDepById:function(a,
20 | d){var b;q(this.depMaps,function(d,f){if(d.id===a)return b=f,!0});return this.defineDep(b,d)},defineDep:function(a,d){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=d)},fetch:function(){if(!this.fetched){this.fetched=!0;h.startTime=(new Date).getTime();var a=this.map;if(this.shim)t(this,!0)(this.shim.deps||[],s(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;R[a]||
21 | (R[a]=!0,h.load(this.map.id,a))},check:function(a){if(this.enabled&&!this.enabling){var d=this.map.id,b=this.depExports,c=this.exports,f=this.factory,e;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(x(f)){if(this.events.error)try{c=h.execCb(d,f,b,c)}catch(g){e=g}else c=h.execCb(d,f,b,c);if(this.map.isDefine)if((b=this.module)&&b.exports!==void 0&&b.exports!==this.exports)c=b.exports;else if(c===void 0&&this.usingExports)c=
22 | this.exports;if(e)return e.requireMap=this.map,e.requireModules=[this.map.id],e.requireType="define",B(this.error=e)}else c=f;this.exports=c;if(this.map.isDefine&&!this.ignore&&(n[d]=c,j.onResourceLoad))j.onResourceLoad(h,this.map,this.depMaps);delete m[d];this.defined=!0;h.waitCount-=1;h.waitCount===0&&(M=[])}this.defining=!1;if(!a&&this.defined&&!this.defineEmitted)this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0}}else this.fetch()}},callPlugin:function(){var a=
23 | this.map,d=a.id,b=g(a.prefix,null,!1,!0);p(b,"defined",s(this,function(b){var f=this.map.name,e=this.map.parentMap?this.map.parentMap.name:null;if(this.map.unnormalized){if(b.normalize&&(f=b.normalize(f,function(a){return c(a,e,!0)})||""),b=g(a.prefix+"!"+f,this.map.parentMap,!1,!0),p(b,"defined",s(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),b=m[b.id]){if(this.events.error)b.on("error",s(this,function(a){this.emit("error",a)}));b.enable()}}else f=s(this,function(a){this.init([],
24 | function(){return a},null,{enabled:!0})}),f.error=s(this,function(a){this.inited=!0;this.error=a;a.requireModules=[d];y(m,function(a){a.map.id.indexOf(d+"_unnormalized")===0&&z(a.map.id)});B(a)}),f.fromText=function(a,d){var b=L;b&&(L=!1);r(g(a));j.exec(d);b&&(L=!0);h.completeLoad(a)},b.load(a.name,t(a.parentMap,!0,function(a,d){a.rjsSkipMap=!0;return h.require(a,d)}),f,k)}));h.enable(b,this);this.pluginMaps[b.id]=b},enable:function(){this.enabled=!0;if(!this.waitPushed)M.push(this),h.waitCount+=
25 | 1,this.waitPushed=!0;this.enabling=!0;q(this.depMaps,s(this,function(a,d){var b,c;if(typeof a==="string"){a=g(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.depMaps.rjsSkipMap);this.depMaps[d]=a;if(b=Q[a.id]){this.depExports[d]=b(this);return}this.depCount+=1;p(a,"defined",s(this,function(a){this.defineDep(d,a);this.check()}));this.errback&&p(a,"error",this.errback)}b=a.id;c=m[b];!Q[b]&&c&&!c.enabled&&h.enable(a,this)}));y(this.pluginMaps,s(this,function(a){var b=m[a.id];b&&!b.enabled&&
26 | h.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){q(this.events[a],function(a){a(b)});a==="error"&&delete this.events[a]}};return h={config:k,contextName:b,registry:m,defined:n,urlFetched:R,waitCount:0,defQueue:F,Module:X,makeModuleMap:g,configure:function(a){a.baseUrl&&a.baseUrl.charAt(a.baseUrl.length-1)!=="/"&&(a.baseUrl+="/");var b=k.pkgs,c=k.shim,e=k.paths,f=k.map;K(k,a,!0);k.paths=K(e,a.paths,!0);if(a.map)k.map=
27 | K(f||{},a.map,!0,!0);if(a.shim)y(a.shim,function(a,b){G(a)&&(a={deps:a});if(a.exports&&!a.exports.__buildReady)a.exports=h.makeShimExports(a.exports);c[b]=a}),k.shim=c;if(a.packages)q(a.packages,function(a){a=typeof a==="string"?{name:a}:a;b[a.name]={name:a.name,location:a.location||a.name,main:(a.main||"main").replace(ja,"").replace(ba,"")}}),k.pkgs=b;y(m,function(a,b){a.map=g(b)});if(a.deps||a.callback)h.require(a.deps||[],a.callback)},makeShimExports:function(a){var b;return typeof a==="string"?
28 | (b=function(){return Z(a)},b.exports=a,b):function(){return a.apply(Y,arguments)}},requireDefined:function(a,b){var c=g(a,b,!1,!0).id;return n.hasOwnProperty(c)},requireSpecified:function(a,b){a=g(a,b,!1,!0).id;return n.hasOwnProperty(a)||m.hasOwnProperty(a)},require:function(a,d,c,e){var f;if(typeof a==="string"){if(x(d))return B(H("requireargs","Invalid require call"),c);if(j.get)return j.get(h,a,d);a=g(a,d,!1,!0);a=a.id;return!n.hasOwnProperty(a)?B(H("notloaded",'Module name "'+a+'" has not been loaded yet for context: '+
29 | b)):n[a]}c&&!x(c)&&(e=c,c=void 0);d&&!x(d)&&(e=d,d=void 0);for(u();F.length;)if(f=F.shift(),f[0]===null)return B(H("mismatch","Mismatched anonymous define() module: "+f[f.length-1]));else V(f);r(g(null,e)).init(a,d,c,{enabled:!0});E();return h.require},undef:function(a){var b=g(a,null,!0),c=m[a];delete n[a];delete R[b.url];delete W[a];if(c){if(c.events.defined)W[a]=c.events;z(a)}},enable:function(a){m[a.id]&&r(a).enable()},completeLoad:function(a){var b=k.shim[a]||{},c=b.exports&&b.exports.exports,
30 | e,f;for(u();F.length;){f=F.shift();if(f[0]===null){f[0]=a;if(e)break;e=!0}else f[0]===a&&(e=!0);V(f)}f=m[a];if(!e&&!n[a]&&f&&!f.inited)if(k.enforceDefine&&(!c||!Z(c)))if(i(a))return;else return B(H("nodefine","No define call for "+a,null,[a]));else V([a,b.deps||[],b.exports]);E()},toUrl:function(a,b){var e=a.lastIndexOf("."),g=null;e!==-1&&(g=a.substring(e,a.length),a=a.substring(0,e));return h.nameToUrl(c(a,b&&b.id,!0),g)},nameToUrl:function(a,b){var c,e,f,g,h,i;if(j.jsExtRegExp.test(a))g=a+(b||
31 | "");else{c=k.paths;e=k.pkgs;g=a.split("/");for(h=g.length;h>0;h-=1)if(i=g.slice(0,h).join("/"),f=e[i],i=c[i]){G(i)&&(i=i[0]);g.splice(0,h,i);break}else if(f){c=a===f.name?f.location+"/"+f.main:f.location;g.splice(0,h,c);break}g=g.join("/")+(b||".js");g=(g.charAt(0)==="/"||g.match(/^[\w\+\.\-]+:/)?"":k.baseUrl)+g}return k.urlArgs?g+((g.indexOf("?")===-1?"?":"&")+k.urlArgs):g},load:function(a,b){j.load(h,a,b)},execCb:function(a,b,c,e){return b.apply(e,c)},onScriptLoad:function(a){if(a.type==="load"||
32 | la.test((a.currentTarget||a.srcElement).readyState))I=null,a=J(a),h.completeLoad(a.id)},onScriptError:function(a){var b=J(a);if(!i(b.id))return B(H("scripterror","Script error",a,[b.id]))}}}};j({});aa(j);if(w&&(t=A.head=document.getElementsByTagName("head")[0],C=document.getElementsByTagName("base")[0]))t=A.head=C.parentNode;j.onError=function(b){throw b;};j.load=function(b,c,e){var i=b&&b.config||{},g;if(w)return g=i.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),
33 | g.type=i.scriptType||"text/javascript",g.charset="utf-8",g.async=!0,g.setAttribute("data-requirecontext",b.contextName),g.setAttribute("data-requiremodule",c),g.attachEvent&&!(g.attachEvent.toString&&g.attachEvent.toString().indexOf("[native code")<0)&&!S?(L=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=e,E=g,C?t.insertBefore(g,C):t.appendChild(g),E=null,g;else ca&&(importScripts(e),b.completeLoad(c))};
34 | w&&N(document.getElementsByTagName("script"),function(b){if(!t)t=b.parentNode;if(u=b.getAttribute("data-main")){if(!p.baseUrl)D=u.split("/"),da=D.pop(),ea=D.length?D.join("/")+"/":"./",p.baseUrl=ea,u=da;u=u.replace(ba,"");p.deps=p.deps?p.deps.concat(u):[u];return!0}});define=function(b,c,e){var i,g;typeof b!=="string"&&(e=c,c=b,b=null);G(c)||(e=c,c=[]);!c.length&&x(e)&&e.length&&(e.toString().replace(ha,"").replace(ia,function(b,e){c.push(e)}),c=(e.length===1?["require"]:["require","exports","module"]).concat(c));
35 | if(L&&(i=E||ga()))b||(b=i.getAttribute("data-requiremodule")),g=z[i.getAttribute("data-requirecontext")];(g?g.defQueue:P).push([b,c,e])};define.amd={jQuery:!0};j.exec=function(b){return eval(b)};j(p)}})(this);
--------------------------------------------------------------------------------
/third-party/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.3.3
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3 | // Underscore is freely distributable under the MIT license.
4 | // Portions of Underscore are inspired or borrowed from Prototype,
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating.
6 | // For all details and documentation:
7 | // http://documentcloud.github.com/underscore
8 | (function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break;
10 | g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a,
11 | c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(A&&
12 | a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,
13 | c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,
14 | a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};
17 | j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=
20 | i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&
25 | c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=
26 | function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"};
27 | b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,
28 | b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId=
29 | function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape||
30 | u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};
31 | b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d,
32 | this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
--------------------------------------------------------------------------------
/utils/build.js:
--------------------------------------------------------------------------------
1 |
2 | var params = {
3 | "baseUrl": "../src/",
4 | "main": "Physics",
5 | "out": "../build/Physics.js",
6 | "minify": false,
7 | "shortcut": "Physics",
8 | "paths": {}
9 | }
10 |
11 | require('./builder.js').build(params);
12 |
13 | // Currently broken.
14 |
15 | // params.minify = true;
16 | // params.out = '../build/Physics.min.js';
17 |
18 | // require('./builder.js').build(params);
--------------------------------------------------------------------------------
/utils/builder.js:
--------------------------------------------------------------------------------
1 | /**
2 | * dat-gui JavaScript Controller Library
3 | * http://code.google.com/p/dat-gui
4 | *
5 | * Copyright 2011 Data Arts Team, Google Creative Lab
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | */
13 |
14 | var fs = require('fs'),
15 | closure = require('./closure'),
16 | params,
17 | defined,
18 | third_party,
19 | request_counts,
20 | next_load = '',
21 | next_path = '';
22 |
23 | exports.build = build;
24 | exports.file_exists = file_exists;
25 | exports.read_file = read_file;
26 | exports.tab = tab;
27 |
28 | exports.license = read_file('../license.txt');
29 |
30 | function build(_params) {
31 |
32 | params = _params;
33 |
34 | defined = {};
35 | third_party = {};
36 | request_counts = {};
37 |
38 | var deps = [];
39 |
40 | load_module(params.baseUrl + params.main + '.js', params.main);
41 |
42 | var to_write = '(function() {\n\nvar root = this, previousShortcut = root.' + params.shortcut + ';\n\n';
43 | var ensured = {};
44 |
45 | for (var name in params.paths) {
46 | var path = params.baseUrl + params.paths[name] + '.js';
47 | var str = read_file(path);
48 | if (str === false) {
49 | console.log('Failed to locate dependency \'' + name + '\' at ' + path);
50 | fail();
51 | }
52 | third_party[name] = str;
53 | to_write += third_party[name] + "\n\n";
54 | if (params.verbose) console.log('Loaded: ' + path);
55 | //deps.push(path);
56 | }
57 |
58 | var shared_count = 0;
59 | for (i in request_counts) {
60 | var count = request_counts[i];
61 | if (count > 1) {
62 | if (i in defined) {
63 | var new_shared = i.replace(/\//g, '.');
64 | var v = new_shared + ' = ' + defined[i].getClosure() + ';\n';
65 | to_write += v + "\n\n";
66 | defined[i].shared = new_shared;
67 | shared_count++;
68 | }
69 | }
70 | }
71 |
72 |
73 | to_write += 'root.' + params.shortcut + ' = ' + params.main.replace(/\//g, '.') + ' = ' + defined[params.main].getClosure() + ';';
74 |
75 | // TODO: Add no conflict
76 |
77 | // to_write += '\n\n';
78 | // to_write += 'root.' + params.shortcut + '.noConflict = function() {\n';
79 | // to_write += 'root.' + params.shortcut + ' = previousShortcut;\n';
80 | // to_write += 'return this;\n';
81 | // to_write += '};\n';
82 | to_write += '\n\n})();'
83 |
84 | if (params.verbose) console.log('Exported: ' + params.main + ' to window.' + params.shortcut);
85 |
86 | if (params.minify) {
87 |
88 | console.log('Compiling minified source ...');
89 |
90 | closure.compile(to_write, function(error, code) {
91 | if (error) {
92 | console.log(error);
93 | } else {
94 | write(exports.license + code);
95 | }
96 | if (params.on_compile) {
97 | params.on_compile();
98 | }
99 | });
100 |
101 | } else {
102 |
103 | write(exports.license + "\n" + to_write);
104 |
105 | }
106 |
107 | return deps;
108 |
109 | }
110 |
111 | function define(deps, callback) {
112 |
113 | this.name = next_load;
114 | this.path = next_path;
115 | this.shared = false;
116 |
117 | defined[this.name] = this;
118 |
119 | if (Array.isArray(deps)) {
120 |
121 | this.deps = deps;
122 | this.callback = callback.toString();
123 | this.module = true;
124 |
125 | // Simple define call, just an object
126 | } else if (typeof deps === 'object') {
127 |
128 | var props = [];
129 | for (var i in deps) {
130 | props.push(i + ':' + deps[i].toString())
131 | }
132 | this.callback = '{' + props.join(',') + '}';
133 | this.module = true;
134 |
135 | } else {
136 |
137 | this.deps = deps;
138 | this.callback = callback;
139 |
140 | }
141 |
142 | this.getClosure = function() {
143 | if (this.shared) return this.shared;
144 | if (!this.deps || this.text) return this.callback;
145 | var arg_string = '(';
146 | var args = [];
147 | for (var i in this.deps) {
148 | var dep = this.deps[i];
149 | if (dep in defined) {
150 | var closure = defined[dep].getClosure();
151 | if (!defined[dep].shared && !defined[dep].text) {
152 | closure = defined[dep].name.replace(/\//g, '.') + ' = ' + closure;
153 | }
154 | args.push(closure);
155 | }
156 | }
157 | arg_string += args.join(',\n');
158 | arg_string += ')';
159 | return '(' + this.callback + ')' + arg_string;
160 |
161 | };
162 |
163 | this.recurseDeps = function() {
164 |
165 | if (!this.deps) return;
166 |
167 | for (var i in this.deps) {
168 |
169 | var dep = this.deps[i];
170 |
171 | if (dep in params.paths) continue;
172 |
173 | var path = params.baseUrl + dep;
174 |
175 | // Define module?
176 | if (file_exists(path + '.js')) {
177 | load_module(path + '.js', dep);
178 |
179 | // Text module?
180 | } else if (path.match(/text!/) != null) {
181 | load_text(path.replace('text!', ''), dep);
182 | }
183 |
184 | // up the request count
185 | if (dep in request_counts) {
186 | request_counts[dep]++
187 | } else {
188 | request_counts[dep] = 1;
189 | }
190 |
191 | }
192 |
193 | };
194 |
195 | this.recurseDeps();
196 |
197 | }
198 |
199 | function file_exists(path) {
200 | try {
201 | var stats = fs.lstatSync(path)
202 | return stats.isFile();
203 | } catch (e) {
204 | return false;
205 | }
206 | }
207 |
208 | function read_file(path) {
209 | try {
210 | return fs.readFileSync(path).toString();
211 | } catch (e) {
212 | return false;
213 | }
214 | }
215 |
216 | function load_module(path, name) {
217 | name = name || path;
218 | if (name in defined) return;
219 | next_load = name;
220 | next_path = path;
221 | eval('new ' + read_file(path));
222 | }
223 |
224 | function load_text(path, name) {
225 | name = name || path;
226 | if (name in defined) return;
227 | var text = read_file(path);
228 | text = text.replace(/\r/g, "\\r");
229 | text = text.replace(/\n/g, "\\n");
230 | text = text.replace(/"/g, "\\\"");
231 | next_load = name;
232 | next_path = path;
233 | var d = new define([], '"' + text + '"');
234 | d.text = true;
235 | d.module = false;
236 | }
237 |
238 | function tab(str, tabs) {
239 | var lines = str.split("\n");
240 | for (var i in lines) {
241 | lines[i] = tabs + lines[i];
242 | }
243 | return lines.join("\n");
244 | }
245 |
246 | function write(str) {
247 | fs.writeFile(params.out, str);
248 | console.log('Saved to ' + params.out);
249 | }
250 |
251 | function fail() {
252 | console.log('Build failed.');
253 | process.exit(0);
254 | }
--------------------------------------------------------------------------------
/utils/closure.js:
--------------------------------------------------------------------------------
1 | /// # Google Closure Compiler Service #
2 | /// https://github.com/weaver/scribbles/blob/master/node/google-closure/lib/closure.js
3 | /// Compress javascript with Node.js using the Closure Compiler
4 | /// Service.
5 | /// Attempted update for Node.js v0.8
6 |
7 | var sys = require('sys');
8 |
9 | exports.compile = compile;
10 |
11 | // Use the Google Closure Compiler Service to compress Javascript
12 | // code.
13 | //
14 | // + code - String of javascript to compress
15 | // + next - Function callback that accepts.
16 | //
17 | // This method will POST the `code` to the compiler service. If an
18 | // error occurs, `next()` will be called with an `Error` object as the
19 | // first argument. Otherwise, the `next()` will be called with `null`
20 | // as the first argument and a String of compressed javascript as the
21 | // second argument.
22 | //
23 | // compile('... javascript ...', function(err, result) {
24 | // if (err) throw err;
25 | //
26 | // ... do something with result ...
27 | // });
28 | //
29 | // Returns nothing.
30 | function compile(code, next) {
31 | try {
32 | var qs = require('querystring'),
33 | http = require('http'),
34 | host = 'closure-compiler.appspot.com',
35 | body = qs.stringify({
36 | js_code: code.toString('utf-8'),
37 | compilation_level: 'SIMPLE_OPTIMIZATIONS',
38 | output_format: 'json',
39 | output_info: 'compiled_code'
40 | }),
41 | req = http.request({
42 | host: host,
43 | port: 80,
44 | path: '/compile',
45 | method: 'POST'
46 | }, function(res) {
47 | if (res.statusCode != 200) {
48 | next(new Error('Unexpected HTTP response: ' + res.statusCode));
49 | return;
50 | }
51 | res.setEncoding('utf-8');
52 | capture(res, parseResponse);
53 | });
54 |
55 | req.on('error', next)
56 | req.write(body);
57 | req.end()
58 |
59 | function parseResponse(err, data) {
60 | err ? next(err) : loadJSON(data, function(err, obj) {
61 | var error;
62 | if (err)
63 | next(err);
64 | else if ((error = obj.errors || obj.serverErrors || obj.warnings))
65 | next(new Error('Failed to compile: ' + sys.inspect(error)));
66 | else
67 | next(null, obj.compiledCode);
68 | });
69 | }
70 | } catch (err) {
71 | next(err);
72 | }
73 | }
74 |
75 | // Convert a Stream to a String.
76 | //
77 | // + input - Stream object
78 | // + encoding - String input encoding
79 | // + next - Function error/success callback
80 | //
81 | // Returns nothing.
82 | function capture(input, next) {
83 |
84 | var buffer = '';
85 |
86 | input.on('data', function(chunk) {
87 | console.log('data chunk: ' + chunk);
88 | buffer += chunk;
89 | });
90 |
91 | input.on('end', function() {
92 | next(null, buffer);
93 | });
94 |
95 | input.on('error', next);
96 | }
97 |
98 | // Convert JSON.load() to callback-style.
99 | //
100 | // + data - String value to load
101 | // + next - Function error/success callback
102 | //
103 | // Returns nothing.
104 | function loadJSON(data, next) {
105 | var err, obj;
106 |
107 | try {
108 | obj = JSON.parse(data);
109 | } catch (x) {
110 | err = x;
111 | }
112 | next(err, obj);
113 | }
--------------------------------------------------------------------------------