Skip to content

Commit 12c48ca

Browse files
committed
Add support for position: -webkit-sticky
1 parent f306a55 commit 12c48ca

File tree

7 files changed

+3029
-2916
lines changed

7 files changed

+3029
-2916
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ Desktop.ini
1010
# NPM files
1111
npm-debug.log
1212
node_modules
13+
14+
# IDE files
15+
.idea

dist/node-parserlib.js

Lines changed: 995 additions & 966 deletions
Large diffs are not rendered by default.

dist/parserlib-core.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
*/
23-
/* Version v1.1.0, Build time: 6-December-2016 10:31:29 */
23+
/* Version v1.1.2, Build time: 5-October-2017 13:33:04 */
2424
var parserlib = (function () {
2525
var require;
2626
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"parserlib-core":[function(require,module,exports){
@@ -58,7 +58,7 @@ function EventTarget() {
5858

5959
EventTarget.prototype = {
6060

61-
//restore constructor
61+
// restore constructor
6262
constructor: EventTarget,
6363

6464
/**
@@ -97,9 +97,9 @@ EventTarget.prototype = {
9797

9898
if (this._listeners[event.type]) {
9999

100-
//create a copy of the array and use that so listeners can't chane
100+
// create a copy of the array and use that so listeners can't chane
101101
var listeners = this._listeners[event.type].concat();
102-
for (var i=0, len=listeners.length; i < len; i++) {
102+
for (var i = 0, len = listeners.length; i < len; i++) {
103103
listeners[i].call(this, event);
104104
}
105105
}
@@ -115,7 +115,7 @@ EventTarget.prototype = {
115115
removeListener: function(type, listener) {
116116
if (this._listeners[type]) {
117117
var listeners = this._listeners[type];
118-
for (var i=0, len=listeners.length; i < len; i++) {
118+
for (var i = 0, len = listeners.length; i < len; i++) {
119119
if (listeners[i] === listener) {
120120
listeners.splice(i, 1);
121121
break;
@@ -201,9 +201,9 @@ TokenStreamBase.createTokenData = function(tokens) {
201201

202202
var nameMap = [],
203203
typeMap = Object.create(null),
204-
tokenData = tokens.concat([]),
205-
i = 0,
206-
len = tokenData.length+1;
204+
tokenData = tokens.concat([]),
205+
i = 0,
206+
len = tokenData.length + 1;
207207

208208
tokenData.UNKNOWN = -1;
209209
tokenData.unshift({ name:"EOF" });
@@ -252,7 +252,7 @@ TokenStreamBase.prototype = {
252252
*/
253253
match: function(tokenTypes, channel) {
254254

255-
//always convert to an array, makes things easier
255+
// always convert to an array, makes things easier
256256
if (!(tokenTypes instanceof Array)) {
257257
tokenTypes = [tokenTypes];
258258
}
@@ -267,7 +267,7 @@ TokenStreamBase.prototype = {
267267
}
268268
}
269269

270-
//no match found, put the token back
270+
// no match found, put the token back
271271
this.unget();
272272
return false;
273273
},
@@ -285,7 +285,7 @@ TokenStreamBase.prototype = {
285285

286286
var token;
287287

288-
//always convert to an array, makes things easier
288+
// always convert to an array, makes things easier
289289
if (!(tokenTypes instanceof Array)) {
290290
tokenTypes = [tokenTypes];
291291
}
@@ -328,61 +328,61 @@ TokenStreamBase.prototype = {
328328
*/
329329
get: function(channel) {
330330

331-
var tokenInfo = this._tokenData,
332-
i =0,
331+
var tokenInfo = this._tokenData,
332+
i = 0,
333333
token,
334334
info;
335335

336-
//check the lookahead buffer first
336+
// check the lookahead buffer first
337337
if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length) {
338338

339339
i++;
340340
this._token = this._lt[this._ltIndex++];
341341
info = tokenInfo[this._token.type];
342342

343-
//obey channels logic
344-
while ((info.channel !== undefined && channel !== info.channel) &&
343+
// obey channels logic
344+
while ((typeof info.channel !== "undefined" && channel !== info.channel) &&
345345
this._ltIndex < this._lt.length) {
346346
this._token = this._lt[this._ltIndex++];
347347
info = tokenInfo[this._token.type];
348348
i++;
349349
}
350350

351-
//here be dragons
352-
if ((info.channel === undefined || channel === info.channel) &&
351+
// here be dragons
352+
if ((typeof info.channel === "undefined" || channel === info.channel) &&
353353
this._ltIndex <= this._lt.length) {
354354
this._ltIndexCache.push(i);
355355
return this._token.type;
356356
}
357357
}
358358

359-
//call token retriever method
359+
// call token retriever method
360360
token = this._getToken();
361361

362-
//if it should be hidden, don't save a token
362+
// if it should be hidden, don't save a token
363363
if (token.type > -1 && !tokenInfo[token.type].hide) {
364364

365-
//apply token channel
365+
// apply token channel
366366
token.channel = tokenInfo[token.type].channel;
367367

368-
//save for later
368+
// save for later
369369
this._token = token;
370370
this._lt.push(token);
371371

372-
//save space that will be moved (must be done before array is truncated)
372+
// save space that will be moved (must be done before array is truncated)
373373
this._ltIndexCache.push(this._lt.length - this._ltIndex + i);
374374

375-
//keep the buffer under 5 items
375+
// keep the buffer under 5 items
376376
if (this._lt.length > 5) {
377377
this._lt.shift();
378378
}
379379

380-
//also keep the shift buffer under 5 items
380+
// also keep the shift buffer under 5 items
381381
if (this._ltIndexCache.length > 5) {
382382
this._ltIndexCache.shift();
383383
}
384384

385-
//update lookahead index
385+
// update lookahead index
386386
this._ltIndex = this._lt.length;
387387
}
388388

@@ -394,10 +394,10 @@ TokenStreamBase.prototype = {
394394
info = tokenInfo[token.type];
395395
if (info &&
396396
(info.hide ||
397-
(info.channel !== undefined && channel !== info.channel))) {
397+
(typeof info.channel !== "undefined" && channel !== info.channel))) {
398398
return this.get(channel);
399399
} else {
400-
//return just the type
400+
// return just the type
401401
return token.type;
402402
}
403403
},
@@ -416,26 +416,26 @@ TokenStreamBase.prototype = {
416416
var total = index,
417417
tt;
418418
if (index > 0) {
419-
//TODO: Store 5 somewhere
419+
// TODO: Store 5 somewhere
420420
if (index > 5) {
421421
throw new Error("Too much lookahead.");
422422
}
423423

424-
//get all those tokens
424+
// get all those tokens
425425
while (total) {
426426
tt = this.get();
427427
total--;
428428
}
429429

430-
//unget all those tokens
430+
// unget all those tokens
431431
while (total < index) {
432432
this.unget();
433433
total++;
434434
}
435435
} else if (index < 0) {
436436

437-
if (this._lt[this._ltIndex+index]) {
438-
tt = this._lt[this._ltIndex+index].type;
437+
if (this._lt[this._ltIndex + index]) {
438+
tt = this._lt[this._ltIndex + index].type;
439439
} else {
440440
throw new Error("Too much lookbehind.");
441441
}
@@ -460,11 +460,11 @@ TokenStreamBase.prototype = {
460460
*/
461461
LT: function(index) {
462462

463-
//lookahead first to prime the token buffer
463+
// lookahead first to prime the token buffer
464464
this.LA(index);
465465

466-
//now find the token, subtract one because _ltIndex is already at the next index
467-
return this._lt[this._ltIndex+index-1];
466+
// now find the token, subtract one because _ltIndex is already at the next index
467+
return this._lt[this._ltIndex + index - 1];
468468
},
469469

470470
/**
@@ -570,7 +570,7 @@ function SyntaxError(message, line, col) {
570570

571571
}
572572

573-
//inherit from Error
573+
// inherit from Error
574574
SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line
575575
SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line
576576

@@ -699,7 +699,7 @@ StringReader.prototype = {
699699
// and reset column count
700700
if (this._input.charAt(this._cursor) === "\n") {
701701
this._line++;
702-
this._col=1;
702+
this._col = 1;
703703
} else {
704704
this._col++;
705705
}

0 commit comments

Comments
 (0)