def tokenize_path(path):
 separators = []
 last_position = 0
 i = (-1)
 in_string = False
 while (i < (len(path) - 1)):
  i = (i + 1)
  if (path[i] == "'"):
   in_string = (not in_string)
  if in_string:
   continue
  if (path[i] == '/'):
   if (i > 0):
    separators.append((last_position, i))
   if (path[(i + 1)] == '/'):
    last_position = i
    i = (i + 1)
   else:
    last_position = (i + 1)
 separators.append((last_position, len(path)))
 steps = []
 for (start, end) in separators:
  steps.append(path[start:end])
 return steps

def tokenize_path ( path ) : separators = [ ] last_position = 0 i = ( - 1 ) in_string = False while ( i < ( len ( path ) - 1 ) ) : i = ( i + 1 ) if ( path [ i ] == "'" ) : in_string = ( not in_string ) if in_string : continue if ( path [ i ] == '/' ) : if ( i > 0 ) : separators . append ( ( last_position , i ) ) if ( path [ ( i + 1 ) ] == '/' ) : last_position = i i = ( i + 1 ) else : last_position = ( i + 1 ) separators . append ( ( last_position , len ( path ) ) ) steps = [ ] for ( start , end ) in separators : steps . append ( path [ start : end ] ) return steps
tokenize a location path into location steps .