diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2014-09-11 09:24:24 -0700 | 
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2014-09-11 11:17:42 -0700 | 
| commit | 9c218c305e175183abd577c07daec5daf230801c (patch) | |
| tree | 1b6c6e04f8f7c6f26fe6e7adb595040902d1b992 /js | |
| parent | 2fc6c0d06f4199f4e7ee6fb0e46337bfc6749d24 (diff) | |
Clarified code logic for last_emphasis_closer.
Diffstat (limited to 'js')
| -rwxr-xr-x | js/stmd.js | 10 | 
1 files changed, 8 insertions, 2 deletions
@@ -294,8 +294,12 @@ var parseEmphasis = function() {    var last_emphasis_closer = null;    var delims_to_match = numdelims; -  while (this.last_emphasis_closer === null || -         this.last_emphasis_closer >= this.pos) { + +  // We need not look for closers if we have already recorded that +  // there are no closers past this point. +  if (this.last_emphasis_closer === null || +      this.last_emphasis_closer >= this.pos) { +    while (true) {          res = this.scanDelims(c);          numclosedelims = res.numdelims;          if (res.can_close) { @@ -325,11 +329,13 @@ var parseEmphasis = function() {          } else {              break;          } +      }      }      // didn't find closing delimiter      this.pos = startpos + numdelims;      if (last_emphasis_closer === null) { +        // we know there are no closers after startpos, so:          this.last_emphasis_closer = startpos;      } else {          this.last_emphasis_closer = last_emphasis_closer;  | 
