summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-24 10:42:28 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-24 10:42:28 -0700
commit8b168e0975d4a6e67ad0dfa9da0421026dbd92ed (patch)
tree8d7df07f30fb3987e7f5591b6475e14d5eb8f818 /js
parent58ade4d5907a76ba538f78662945735e3d81388a (diff)
js: Removed memoization.
It is no longer needed with the new stack-based emphasis parsing.
Diffstat (limited to 'js')
-rw-r--r--js/lib/inlines.js17
1 files changed, 2 insertions, 15 deletions
diff --git a/js/lib/inlines.js b/js/lib/inlines.js
index b7f4d1d..5fde099 100644
--- a/js/lib/inlines.js
+++ b/js/lib/inlines.js
@@ -617,18 +617,11 @@ var parseReference = function(s, refmap) {
};
// Parse the next inline element in subject, advancing subject position.
-// If memoize is set, memoize the result.
// On success, add the result to the inlines list, and return true.
// On failure, return false.
-var parseInline = function(inlines, memoize) {
+var parseInline = function(inlines) {
var startpos = this.pos;
var origlen = inlines.length;
- var memoized = memoize && this.memo[startpos];
- if (memoized) {
- this.pos = memoized.endpos;
- Array.prototype.push.apply(inlines, memoized.inline);
- return true;
- }
var c = this.peek();
if (c === -1) {
@@ -671,10 +664,6 @@ var parseInline = function(inlines, memoize) {
inlines.push({t: 'Str', c: fromCodePoint(c)});
}
- if (memoize) {
- this.memo[startpos] = { inline: inlines.slice(origlen),
- endpos: this.pos };
- }
return true;
};
@@ -683,10 +672,9 @@ var parseInlines = function(s, refmap) {
this.subject = s;
this.pos = 0;
this.refmap = refmap || {};
- this.memo = {};
this.emphasis_openers = null;
var inlines = [];
- while (this.parseInline(inlines, false)) {
+ while (this.parseInline(inlines)) {
}
return inlines;
};
@@ -699,7 +687,6 @@ function InlineParser(){
emphasis_openers: null, // used by parseEmphasis method
pos: 0,
refmap: {},
- memo: {},
match: match,
peek: peek,
spnl: spnl,