contrib/byteify-strings.py
changeset 42674 70bd1965bd07
parent 42247 970aaf38c3fc
child 42675 e9592e113c31
equal deleted inserted replaced
42673:74b4cd091e0d 42674:70bd1965bd07
    76 
    76 
    77         Ignores tokens that are not strings. Assumes bounds checking has
    77         Ignores tokens that are not strings. Assumes bounds checking has
    78         already been done.
    78         already been done.
    79 
    79 
    80         """
    80         """
    81         st = tokens[j]
    81         k = j
    82         if st.type == token.STRING and st.string.startswith(("'", '"')):
    82         currtoken = tokens[k]
    83             sysstrtokens.add(st)
    83         while currtoken.type in (token.STRING, token.NEWLINE, tokenize.NL):
       
    84             k += 1
       
    85             if (
       
    86                 currtoken.type == token.STRING
       
    87                 and currtoken.string.startswith(("'", '"'))
       
    88             ):
       
    89                 sysstrtokens.add(currtoken)
       
    90             try:
       
    91                 currtoken = tokens[k]
       
    92             except IndexError:
       
    93                 break
    84 
    94 
    85     coldelta = 0  # column increment for new opening parens
    95     coldelta = 0  # column increment for new opening parens
    86     coloffset = -1  # column offset for the current line (-1: TBD)
    96     coloffset = -1  # column offset for the current line (-1: TBD)
    87     parens = [(0, 0, 0)]  # stack of (line, end-column, column-offset)
    97     parens = [(0, 0, 0)]  # stack of (line, end-column, column-offset)
    88     for i, t in enumerate(tokens):
    98     for i, t in enumerate(tokens):