Skip to content

Commit

Permalink
rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Apr 7, 2020
1 parent 40242a2 commit 5da102d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 52 deletions.
32 changes: 16 additions & 16 deletions src/Lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ module.exports = class Lexer {
.replace(/\r\n|\r/g, '\n')
.replace(/\t/g, ' ');

this.blockTokens(this.tokens, src);
this.blockTokens(src, this.tokens);

this.inlineTokens(this.tokens);
this.inline(this.tokens);

return this.tokens;
}

/**
* Lexing
*/
blockTokens(tokens, src, top = true) {
blockTokens(src, tokens, top = true) {
src = src.replace(/^ +$/gm, '');
let next,
loose,
Expand Down Expand Up @@ -210,7 +210,7 @@ module.exports = class Lexer {
tokens.push({
type: 'blockquote',
raw,
tokens: this.blockTokens([], cap, top)
tokens: this.blockTokens(cap, [], top)
});

continue;
Expand Down Expand Up @@ -297,7 +297,7 @@ module.exports = class Lexer {
task: istask,
checked: ischecked,
loose: loose,
tokens: this.blockTokens([], item, false)
tokens: this.blockTokens(item, [], false)
});
}

Expand Down Expand Up @@ -426,7 +426,7 @@ module.exports = class Lexer {
return tokens;
}

inlineTokens(tokens) {
inline(tokens) {
let i,
j,
k,
Expand All @@ -442,7 +442,7 @@ module.exports = class Lexer {
case 'text':
case 'heading': {
token.tokens = [];
this.inlineOutput(token.text, token.tokens);
this.inlineTokens(token.text, token.tokens);
break;
}
case 'table': {
Expand All @@ -455,7 +455,7 @@ module.exports = class Lexer {
l2 = token.header.length;
for (j = 0; j < l2; j++) {
token.tokens.header[j] = [];
this.inlineOutput(token.header[j], token.tokens.header[j]);
this.inlineTokens(token.header[j], token.tokens.header[j]);
}

// cells
Expand All @@ -465,20 +465,20 @@ module.exports = class Lexer {
token.tokens.cells[j] = [];
for (k = 0; k < row.length; k++) {
token.tokens.cells[j][k] = [];
this.inlineOutput(row[k], token.tokens.cells[j][k]);
this.inlineTokens(row[k], token.tokens.cells[j][k]);
}
}

break;
}
case 'blockquote': {
this.inlineTokens(token.tokens);
this.inline(token.tokens);
break;
}
case 'list': {
l2 = token.items.length;
for (j = 0; j < l2; j++) {
this.inlineTokens(token.items[j].tokens);
this.inline(token.items[j].tokens);
}
break;
}
Expand All @@ -494,7 +494,7 @@ module.exports = class Lexer {
/**
* Lexing/Compiling
*/
inlineOutput(src, tokens) {
inlineTokens(src, tokens) {
let out = '',
link,
text,
Expand Down Expand Up @@ -618,7 +618,7 @@ module.exports = class Lexer {
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[4] || cap[3] || cap[2] || cap[1], newTokens);
text = this.inlineTokens(cap[4] || cap[3] || cap[2] || cap[1], newTokens);

tokens.push({
type: 'strong',
Expand All @@ -635,7 +635,7 @@ module.exports = class Lexer {
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1], newTokens);
text = this.inlineTokens(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1], newTokens);
tokens.push({
type: 'em',
raw,
Expand Down Expand Up @@ -677,7 +677,7 @@ module.exports = class Lexer {
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[1], newTokens);
text = this.inlineTokens(cap[1], newTokens);
tokens.push({
type: 'del',
raw,
Expand Down Expand Up @@ -797,7 +797,7 @@ module.exports = class Lexer {
const newTokens = tokens ? [] : null;

if (cap[0].charAt(0) !== '!') {
const text = this.inlineOutput(cap[1], newTokens);
const text = this.inlineTokens(cap[1], newTokens);
tokens.push({
type: 'link',
raw,
Expand Down

0 comments on commit 5da102d

Please sign in to comment.