Skip to content

Commit

Permalink
Edit some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Dec 23, 2016
1 parent db65031 commit 75933fc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/assets/htmlMatcher.js
Expand Up @@ -62,10 +62,11 @@ define(function(require, exports, module) {
};

/**
* Extend the range with another range. It is O(n) to extend n ranges.
* Extend the range with another range. We have to search the sequence for
* the position of the new range.
*/
Range.prototype.extend = function(range){
// LeftPair, the right most range that l.start < range.start
// find the right most range that l.start < range.start
var l = this;
if (l.start < range.start) {
while (l.next && l.next.start < range.start) {
Expand All @@ -76,7 +77,7 @@ define(function(require, exports, module) {
l = l.prev;
}
}
// RightPair, the left most range that r.end > range.end
// find the left most range that r.end > range.end
var r = this;
if (r.end > range.end) {
while (r.prev && r.prev.end > range.end) {
Expand Down Expand Up @@ -165,7 +166,7 @@ define(function(require, exports, module) {
return range;
};

// Match, a data class represented with position, match token, tag name.
// Find @token in @text.
var Match = function(text, startPos, token, name, excludeRange) {
this.text = text;
this.i = startPos;
Expand Down Expand Up @@ -350,7 +351,7 @@ define(function(require, exports, module) {

TreeResult.finished = new TreeResult(null, null, true);

// Tag tree, built with a MatchGroup.
// Tag tree, built with a MatchGroup. It has a stack to save the match result
var Tree = function(matchGroup, direction, root) {
this.matchGroup = matchGroup;
this.root = root;
Expand Down Expand Up @@ -600,7 +601,7 @@ define(function(require, exports, module) {
}
};

// When an exclude range is added, extending current range is not enough. We have to tell every trees to clean up their tag stack.
// When an excludeRange is added, extending current range is not enough. We have to tell every trees to clean up their tag stack.
Search.prototype.cleanTreeStack = function(range) {
this.main.stackExclude(range);
if (this.explicit) {
Expand Down Expand Up @@ -628,7 +629,7 @@ define(function(require, exports, module) {
}
};

// Try to find a tag on @pos
// Match a tag on @pos. This is used by Match.next, Match.back
function matchTag(pos, text) {
var match;
if (text[pos + 1] == "/") {
Expand Down

0 comments on commit 75933fc

Please sign in to comment.