Find characters with iota subscript and replace w/ char + iota added.
188282
def expand_iota_subscript(input_str, lowercase=False):
    """"""
    new_list = []
    for char in input_str:
        new_char = MAP_SUBSCRIPT_NO_SUB.get(char)
        if not new_char:
            new_char = char
        new_list.append(new_char)
    new_str = ''.join(new_list)
    if lowercase:
        new_str = new_str.lower()
    return new_str
1263938
def force_ascii_values(data):
    """"""
    return {
        k: v.encode('utf8').decode('ascii', 'backslashreplace')
        for k, v in data.items()
    }
588395
def replace(self, src: str) -> str:
        
        if not self.readied:
            self.ready()

        # Brackets + simple pre replacements:
        src = self._dict_replace(self.simple_pre, src)

        # Superscripts and subscripts + pre regexps:
        for regex, replace in self.regex_pre:
            src = regex.sub(replace, src)

        # Unary and binary operators:
        src = self._operators_replace(src)

        # Loop regexps:
        src_prev = src
        for i in range(self.max_iter):
            for regex, replace in self.loop_regexps:
                src = regex.sub(replace, src)
            if src_prev == src:
                break
            else:
                src_prev = src

        # Post regexps:
        for regex, replace in self.regex_post:
            src = regex.sub(replace, src)

        # Simple post replacements:
        src = self._dict_replace(self.simple_post, src)

        # Escape characters:
        src = self.escapes_regex.sub(r'\1', src)

        return src
475696
def _tokenize(bytes, mimetype, extra_tokens=True):
    

    # Start with only the ASCII bytes. Limit it to 8+ character strings.
    try:
        ascii_bytes = b' '.join(re.compile(b'[\x00\x09\x0A\x0D\x20-\x7E]{8,}').findall(bytes))
        ascii_bytes = ascii_bytes.replace(b'\x00', b'')
    except:
        return []

    tokens = []

    # Find anything sandwiched between ( )
    results = re.compile(b'\(([^\)]+)\)').findall(ascii_bytes)
    #results = re.compile(b'\(([^\(\)]+)\)').findall(ascii_bytes)
    tokens += results

    # Find anything sandwiched between < >
    results = re.compile(b'\<([^\>]+)\>').findall(ascii_bytes)
    #results = re.compile(b'\<([^\<\>]+)\>').findall(ascii_bytes)
    tokens += results

    # Find anything sandwiched between [ ]
    results = re.compile(b'\[([^\]]+)\]').findall(ascii_bytes)
    #results = re.compile(b'\[([^\[\]]+)\]').findall(ascii_bytes)
    tokens += results

    # Find anything sandwiched between { }
    results = re.compile(b'\{([^\}]+)\}').findall(ascii_bytes)
    #results = re.compile(b'\{([^\{\}]+)\}').findall(ascii_bytes)
    tokens += results

    if not mimetype == 'data':

        # Find anything sandwiched between ' '
        results = re.compile(b'\'\s*(.*?)\s*\'').findall(ascii_bytes)
        tokens += results

        # Find anything sandwiched between " "
        results = re.compile(b'\"\s*(.*?)\s*\"').findall(ascii_bytes)
        tokens += results

    # Find anything sandwiched between spaces
    results = re.compile(b'\ ([^\ ]+)\ ').findall(ascii_bytes)
    tokens += results

    # Break the bytes apart if we want to generate even more tokens.
    if extra_tokens:

        # Add each newline as a token.
        lines = ascii_bytes.decode('ascii', errors='ignore').splitlines()
        tokens += [l.encode('ascii') for l in lines]

        # Now replace these characters in the ASCII bytes with spaces to create more tokens.
        replace_these = [b'(', b')', b'<', b'>', b'[', b']', b'{', b'}', b"'", b'"', b'\n', b'\r', b'\t', b'\\', b'`', b';']
        for char in replace_these:
            ascii_bytes = ascii_bytes.replace(char, b' ')

        # Split the bytes on spaces and use the results as tokens.
        tokens += ascii_bytes.split(b' ')

    # Decode the tokens as ASCII.
    tokens = [token.decode('ascii', errors='ignore') for token in tokens]

    # Since we want this to find full URLs and not just potential domain names, we want
    # to ensure that the tokens have at least "http" or "/" in them.
    tokens = list(set([t for t in tokens if ('http' in t or 'ftp' in t or ('/' in t and '.' in t)) and len(t) >= 8]))

    # Remove any tokens that look like they're probably bad based on the regex statements above.
    tokens = [t for t in tokens if not all(x in t for x in ['(', ')'])]
    tokens = [t for t in tokens if not all(x in t for x in ['<', '>'])]
    tokens = [t for t in tokens if not all(x in t for x in ['[', ']'])]
    tokens = [t for t in tokens if not all(x in t for x in ['{', '}'])]
    tokens = [t for t in tokens if not any(x in t for x in ['\t', '\n', '\r'])]
    tokens = [t for t in tokens if t[:1].isalpha() or t[:1].isdigit()]
    tokens = [t for t in tokens if not t.count('\'') > 1]
    tokens = [t for t in tokens if not t.count('\"') > 1]

    # Return a list of the tokens in ASCII format.
    return tokens
625966
function rtrim(input, chars) {

  var trim = chars || '\\s';

  if(!isString(input)) {
    return input;
  }

  return input.replace(new RegExp(trim + '+$'), '');
}
1325764
def _sub_ms_char(self, match):
        """"""
        orig = match.group(1)
        if self.smart_quotes_to == 'ascii':
            sub = self.MS_CHARS_TO_ASCII.get(orig).encode()
        else:
            sub = self.MS_CHARS.get(orig)
            if type(sub) == tuple:
                if self.smart_quotes_to == 'xml':
                    sub = '&#x'.encode() + sub[1].encode() + ';'.encode()
                else:
                    sub = '&'.encode() + sub[0].encode() + ';'.encode()
            else:
                sub = sub.encode()
        return sub
461616
function base32DecodeNextCharacter(chunk, characterIndex, buffer, index) {
    const byteIndex = Math.floor(index + (characterIndex * 5) / 8);
    const offset = characterIndex % 8;
    switch (offset) {
        case 0:
            buffer[byteIndex] |= chunk << 3;
            break;
        case 1:
            buffer[byteIndex] |= chunk >>> 2;
            buffer[byteIndex + 1] |= chunk << 6;
            break;
        case 2:
            buffer[byteIndex] |= chunk << 1;
            break;
        case 3:
            buffer[byteIndex] |= chunk >>> 4;
            buffer[byteIndex + 1] |= chunk << 4;
            break;
        case 4:
            buffer[byteIndex] |= chunk >>> 1;
            buffer[byteIndex + 1] |= chunk << 7;
            break;
        case 5:
            buffer[byteIndex] |= chunk << 2;
            break;
        case 6:
            buffer[byteIndex] |= chunk >>> 3;
            buffer[byteIndex + 1] |= chunk << 5;
            break;
        case 7:
            buffer[byteIndex] |= chunk;
            break;
    }
}
573762
def p_chars(self, p):
        """"""
        if len(p) == 1:
            p[0] = unicode()
        else:
            p[0] = p[1] + p[2]
1321750
function fixedCharCodeAt(str, idx) {
  idx = idx || 0;
  var code = str.charCodeAt(idx), hi, low;
  if (0xD800 <= code && code <= 0xDBFF) {
    // High surrogate (could change last
    // hex to 0xDB7F to treat high private
    // surrogates as single characters)
    hi = code;
    low = str.charCodeAt(idx + 1);
    return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
  }
  if (0xDC00 <= code && code <= 0xDFFF) {
    // Low surrogate
    // We return false to allow loops to skip this iteration since should have
    // already handled high surrogate above in the previous iteration
    return false;
    /*hi = str.charCodeAt(idx-1);
     low = code;
     return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;*/
  }
  return code;
}
290238
def match_any_char(self, chars, offset=0):
        """"""
        if not self.has_space(offset=offset):
            return ''
        current = self.string[self.pos + offset]
        return current if current in chars else ''
472140
static void string(BufferedSink sink, String value) throws IOException {
    String[] replacements = REPLACEMENT_CHARS;
    sink.writeByte('"');
    int last = 0;
    int length = value.length();
    for (int i = 0; i < length; i++) {
      char c = value.charAt(i);
      String replacement;
      if (c < 128) {
        replacement = replacements[c];
        if (replacement == null) {
          continue;
        }
      } else if (c == '\u2028') {
        replacement = "\\u2028";
      } else if (c == '\u2029') {
        replacement = "\\u2029";
      } else {
        continue;
      }
      if (last < i) {
        sink.writeUtf8(value, last, i);
      }
      sink.writeUtf8(replacement);
      last = i + 1;
    }
    if (last < length) {
      sink.writeUtf8(value, last, length);
    }
    sink.writeByte('"');
  }
476857
function( input ) {

    var len = input.length
    var chr, out = ''

    function hex( number ) {
      return number.toString( 16 ).toUpperCase()
    }

    for( var i = 0; i < len; i++ ) {
      chr = input.charCodeAt( i )
      if( chr >= 0x41 && chr <= 0x5A ) {
        out = out + input[i]
      } else if( chr >= 0x61 && chr <= 0x7A ) {
        out = out + input[i]
      } else if( chr >= 0x30 && chr <= 0x39 ) {
        out = out + input[i]
      } else if( input[i].match( /[-_.!~*'()]/ ) ) {
        out = out + input[i]
      } else if( chr <= 0x007F ) {
        out = out + '%' + hex( chr )
      } else if( chr <= 0x07FF ) {
        out = out + '%' + hex( 0xC0 | (chr >>   6) )
        out = out + '%' + hex( 0x80 | (chr & 0x3F) )
      } else {
        out = out + '%' + hex( 0xE0 | (chr >> 12) )
        out = out + '%' + hex( 0x80 | ((chr >> 6) & 0x3F) )
        out = out + '%' + hex( 0x80 | (chr & 0x3F) )
      }
    }

    return out

  }
35690
private static String replaceChars(String str)
  {
    StringBuffer buf = new StringBuffer(str);
    int length = buf.length();
    for (int i = 0; i < length; i++)
    {
      char currentChar = buf.charAt(i);
      // Replace space with "%20"
      if (currentChar == ' ')
      {
        buf.setCharAt(i, '%');
        buf.insert(i+1, "20");
        length = length + 2;
        i = i + 2;
      }
      // Replace backslash with forward slash
      else if (currentChar == '\\')
      {
        buf.setCharAt(i, '/');
      }
    }

    return buf.toString();
  }
176558
private static int matchesAt(CharSequence text, int offsetInText, CharSequence substring) {
        int len = substring.length();
        int textLength = text.length();
        if (textLength + offsetInText > len) {
            return -1;
        }
        int i = 0;
        for (int j = offsetInText; i < len; ++i, ++j) {
            char pc = substring.charAt(i);
            char tc = text.charAt(j);
            if (pc != tc) return -1;
        }
        return i;
    }
5241
def add_escape(self, idx, char):
        

        self.fmt.append_text(self.fmt._unescape.get(
            self.format[self.str_begin:idx], char))
830602
private String replaceMetaChars(String input) {
    //escape backslash first since that character is used to escape the remaining meta chars
    input = input.replaceAll("\\\\", "\\\\\\");

    //don't escape star - it's used as the wildcard
    input = input.replaceAll(Pattern.quote("]"), "\\\\]");
    input = input.replaceAll(Pattern.quote("["), "\\\\[");
    input = input.replaceAll(Pattern.quote("^"), "\\\\^");
    input = input.replaceAll(Pattern.quote("$"), "\\\\$");
    input = input.replaceAll(Pattern.quote("."), "\\\\.");
    input = input.replaceAll(Pattern.quote("|"), "\\\\|");
    input = input.replaceAll(Pattern.quote("?"), "\\\\?");
    input = input.replaceAll(Pattern.quote("+"), "\\\\+");
    input = input.replaceAll(Pattern.quote("("), "\\\\(");
    input = input.replaceAll(Pattern.quote(")"), "\\\\)");
    input = input.replaceAll(Pattern.quote("-"), "\\\\-");
    input = input.replaceAll(Pattern.quote("{"), "\\\\{");
    input = input.replaceAll(Pattern.quote("}"), "\\\\}");
    input = input.replaceAll(Pattern.quote("#"), "\\\\#");
    return input;
  }
797334
def match(self, chars):
        """"""
        start_index = self.next_index
        for char in self:
            if char not in chars:
                self.next_index -= 1
                break
        return self[start_index:self.next_index]