MCPcopy Create free account
hub / github.com/TruthHun/BookStack / readNextToken

Function readNextToken

static/word2md/mammoth.browser.js:15315–15341  ·  view source on GitHub ↗
(string, startIndex, source)

Source from the content-addressed store, hash-verified

15313 }
15314
15315 function readNextToken(string, startIndex, source) {
15316 for (var i = 0; i < rules.length; i++) {
15317 var regex = rules[i].regex;
15318 regex.lastIndex = startIndex;
15319 var result = regex.exec(string);
15320
15321 if (result) {
15322 var endIndex = startIndex + result[0].length;
15323 if (result.index === startIndex && endIndex > startIndex) {
15324 var value = result[1];
15325 var token = new Token(
15326 rules[i].name,
15327 value,
15328 source.range(startIndex, endIndex)
15329 );
15330 return {token: token, endIndex: endIndex};
15331 }
15332 }
15333 }
15334 var endIndex = startIndex + 1;
15335 var token = new Token(
15336 "unrecognisedCharacter",
15337 string.substring(startIndex, endIndex),
15338 source.range(startIndex, endIndex)
15339 );
15340 return {token: token, endIndex: endIndex};
15341 }
15342
15343 function endToken(input, source) {
15344 return new Token(

Callers 1

tokeniseFunction · 0.70

Calls 1

rangeMethod · 0.45

Tested by

no test coverage detected