MCPcopy Create free account
hub / github.com/sql-js/sql.js / processKeywords

Function processKeywords

documentation/javascript/application.js:440–461  ·  view source on GitHub ↗
(buffer, mode)

Source from the content-addressed store, hash-verified

438 }
439
440 function processKeywords(buffer, mode) {
441 buffer = escape(buffer);
442 if (!mode.keywords)
443 return buffer;
444 var result = '';
445 var last_index = 0;
446 mode.lexemsRe.lastIndex = 0;
447 var match = mode.lexemsRe.exec(buffer);
448 while (match) {
449 result += buffer.substr(last_index, match.index - last_index);
450 var keyword_match = keywordMatch(mode, match);
451 if (keyword_match) {
452 keyword_count += keyword_match[1];
453 result += '<span class="'+ keyword_match[0] +'">' + match[0] + '</span>';
454 } else {
455 result += match[0];
456 }
457 last_index = mode.lexemsRe.lastIndex;
458 match = mode.lexemsRe.exec(buffer);
459 }
460 return result + buffer.substr(last_index, buffer.length - last_index);
461 }
462
463 function processBuffer(buffer, mode) {
464 if (mode.subLanguage && languages[mode.subLanguage]) {

Callers 1

processBufferFunction · 0.85

Calls 2

escapeFunction · 0.85
keywordMatchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…