Set the closing line/col for a list from the closing token (e.g. ")")
16802
function setClosing(tokenOrLexer) {
    metaObj.endLine = tokenOrLexer.line;
    metaObj.endCol = tokenOrLexer.col;

    // whitespace or comments that preceded the end token
    // (e.g. on a () list whitespace or comments that preceded ")")
    metaObj.endPrelude = tokenOrLexer.prelude;
  }
1320855
def _get_column_ends(self):
        '''
        '''
        ends = collections.Counter()
        for line in self.text.splitlines():
            for matchobj in re.finditer('\s{2,}', line.lstrip()):
                ends[matchobj.end()] += 1
        return ends
416289
function(block, line_number) {
  var b = block;
  var last_list = null;
  do {
    if (b.t === 'List') {
      last_list = b;
    }
    b = b.parent;
  } while (b);

  if (last_list) {
    while (block != last_list) {
      this.finalize(block, line_number);
      block = block.parent;
    }
    this.finalize(last_list, line_number);
    this.tip = last_list.parent;
  }
}
650797
def handle_set_command_list(self, line: str, position: int, tokens: ParseResults) -> ParseResults:
        """"""
        key, values = tokens['key'], tokens['values']
        for value in values:
            self.raise_for_invalid_annotation_value(line, position, key, value)
        self.annotations[key] = set(values)
        return tokens
992114
private static String highlightToken(String line, Token token)
    {
        String newLine = insertChar(line, getLastCharPositionInLine(token), ']');
        return insertChar(newLine, token.getCharPositionInLine(), '[');
    }
347049
def wrap_line(line, limit=None, chars=80):
    
    result = []
    builder = []
    length = 0
    if limit is not None:
        sline = line[0:limit]
    else:
        sline = line
        
    for word in sline.split():
        if length <= chars:
            builder.append(word)
            length += len(word) + 1
        else:
            result.append(' '.join(builder))
            builder = [word]
            length = 0

    result.append(' '.join(builder))
    return result
603272
def handle_endtag(self, tag):
        """"""
        if tag.lower() in self.allowed_tag_whitelist:
            if tag.lower() in ['ul', 'ol']:
                self.previous_type_lists = self.previous_type_lists[:-1]
                if tag.lower() == 'ol':
                    self.nb = self.previous_nbs[-1]
                    self.previous_nbs = self.previous_nbs[:-1]
                # we must remove any non-relevant spacing and end of
                # line before
                self.result = self.result.rstrip()
                self.result += '\n' + self.line_quotation
1066587
def _close_list(self):
        
        list_type = self.current_parent_element['attrs']['class']
        tag = LIST_TYPES[list_type]

        html = '</{t}>'.format(
            t=tag
        )
        self.cleaned_html += html
        self.current_parent_element['tag'] = ''
        self.current_parent_element['attrs'] = {}
489059
function setToken(list, token, enabled){
		enabled ? list.add(token) : list.remove(token);
	}
702055
private static String formatListToString(final List<String> list)
	{
		int lineLength = 0;
		final StringBuffer sb = new StringBuffer();
		for (final String str : list)
		{
			final int length = str.length();
			lineLength = length + lineLength;
			sb.append(str);
			sb.append(", ");
			if (100 < lineLength)
			{
				sb.append("\n");
				lineLength = 0;
			}
		}
		return sb.toString().trim();
	}
332214
def make_list(self, end_token="]"):
        
        out = []
        while True:
            try:
                value = self.value_assign(end_token=end_token)
                out.append(value)
                self.separator(end_token=end_token)
            except self.ParseEnd:
                return out
1228266
function(list, delim) {
            return new Anonymous(!isArray(list.value)
                ? list.toCSS()
                : list.value.map(function(a) {
                    return toString(a, "", "");
                }).join(delim ? delim.value : ", "));
        }
463206
def _handle_tag_close_close(self):
        """"""
        strip = lambda tok: tok.text.rstrip().lower()
        closing = self._pop()
        if len(closing) != 1 or (not isinstance(closing[0], tokens.Text) or
                                 strip(closing[0]) != strip(self._stack[1])):
            self._fail_route()
        self._emit_all(closing)
        self._emit(tokens.TagCloseClose())
        return self._pop()
264035
private void matchEndLine() {
		// First, parse all whitespace characters except for new lines
		index = skipLineSpace(index);

		// Second, check whether we've reached the end-of-file (as signaled by
		// running out of tokens), or we've encountered some token which not a
		// newline.
		if (index >= tokens.size()) {
			return; // EOF
		} else if (tokens.get(index).kind != NewLine) {
			syntaxError("expected end-of-line", tokens.get(index));
		} else {
			index = index + 1;
		}
	}
295853
function listitem(text) {
  if (inList()) {

    // capture value in trailing "text" - unescape makes regexp work
    var m = unescapeQuotes(text).match(/^(.*)\s+"([^"]*)"\s*$/);

    var txt = m ? escapeQuotes(m[1]) : text;
    var val = m ? escapeQuotes(m[2]) : text;

    return renderOption(txt, val);
  }
  return fallback.listitem.call(this, text);
}
686235
def insert_in_next_line(tokens, index, string):
    
    tokenized_string = token_utils.listified_tokenizer(string)
    for i, tok in list(enumerate(tokens[index:])):
        token_type = tok[0]
        if token_type in [tokenize.NL, tokenize.NEWLINE]:
            for count, item in enumerate(tokenized_string):
                tokens.insert(index+count+i+1, item)
            break
460411
function(s_line, s_close_delim, z_merge_delim) {

				// open block
				add(
					s_line || '',
					z_merge_delim,
					true
				);

				// set close delim
				s_close = ('string' === typeof s_close_delim)? s_close_delim: a_closers.slice(-1)[0];
				a_closers.push(s_close);

				// increase indentation
				add.tabs += 1;
			}