def in_string(state, text, i, formats, user_data):
 q = (u'"' if (state.parse == IN_DQS) else u"'")
 pos = text.find(q, i)
 if (pos == (-1)):
  if (text[(-1)] == u'\\'):
   return [((len(text) - i), formats[u'string'])]
  state.parse = (NORMAL if (state.blocks < 1) else IN_CONTENT)
  return [((len(text) - i), formats[u'unterminated-string'])]
 state.parse = (NORMAL if (state.blocks < 1) else IN_CONTENT)
 return [(((pos - i) + len(q)), formats[u'string'])]

def in_string ( state , text , i , formats , user_data ) : q = ( u'"' if ( state . parse == IN_DQS ) else u"'" ) pos = text . find ( q , i ) if ( pos == ( - 1 ) ) : if ( text [ ( - 1 ) ] == u'\\' ) : return [ ( ( len ( text ) - i ) , formats [ u'string' ] ) ] state . parse = ( NORMAL if ( state . blocks < 1 ) else IN_CONTENT ) return [ ( ( len ( text ) - i ) , formats [ u'unterminated-string' ] ) ] state . parse = ( NORMAL if ( state . blocks < 1 ) else IN_CONTENT ) return [ ( ( ( pos - i ) + len ( q ) ) , formats [ u'string' ] ) ]
inside a string .