##// END OF EJS Templates
ui: fix configlist on Python 3...
Augie Fackler -
r31156:e5aab82e default
parent child Browse files
Show More
@@ -569,37 +569,38 b' class ui(object):'
569 569
570 570 def _parse_plain(parts, s, offset):
571 571 whitespace = False
572 while offset < len(s) and (s[offset].isspace() or s[offset] == ','):
572 while offset < len(s) and (s[offset:offset + 1].isspace()
573 or s[offset:offset + 1] == ','):
573 574 whitespace = True
574 575 offset += 1
575 576 if offset >= len(s):
576 577 return None, parts, offset
577 578 if whitespace:
578 579 parts.append('')
579 if s[offset] == '"' and not parts[-1]:
580 if s[offset:offset + 1] == '"' and not parts[-1]:
580 581 return _parse_quote, parts, offset + 1
581 elif s[offset] == '"' and parts[-1][-1] == '\\':
582 parts[-1] = parts[-1][:-1] + s[offset]
582 elif s[offset:offset + 1] == '"' and parts[-1][-1] == '\\':
583 parts[-1] = parts[-1][:-1] + s[offset:offset + 1]
583 584 return _parse_plain, parts, offset + 1
584 parts[-1] += s[offset]
585 parts[-1] += s[offset:offset + 1]
585 586 return _parse_plain, parts, offset + 1
586 587
587 588 def _parse_quote(parts, s, offset):
588 if offset < len(s) and s[offset] == '"': # ""
589 if offset < len(s) and s[offset:offset + 1] == '"': # ""
589 590 parts.append('')
590 591 offset += 1
591 while offset < len(s) and (s[offset].isspace() or
592 s[offset] == ','):
592 while offset < len(s) and (s[offset:offset + 1].isspace() or
593 s[offset:offset + 1] == ','):
593 594 offset += 1
594 595 return _parse_plain, parts, offset
595 596
596 while offset < len(s) and s[offset] != '"':
597 if (s[offset] == '\\' and offset + 1 < len(s)
598 and s[offset + 1] == '"'):
597 while offset < len(s) and s[offset:offset + 1] != '"':
598 if (s[offset:offset + 1] == '\\' and offset + 1 < len(s)
599 and s[offset + 1:offset + 2] == '"'):
599 600 offset += 1
600 601 parts[-1] += '"'
601 602 else:
602 parts[-1] += s[offset]
603 parts[-1] += s[offset:offset + 1]
603 604 offset += 1
604 605
605 606 if offset >= len(s):
@@ -613,11 +614,11 b' class ui(object):'
613 614 return None, parts, offset
614 615
615 616 offset += 1
616 while offset < len(s) and s[offset] in [' ', ',']:
617 while offset < len(s) and s[offset:offset + 1] in [' ', ',']:
617 618 offset += 1
618 619
619 620 if offset < len(s):
620 if offset + 1 == len(s) and s[offset] == '"':
621 if offset + 1 == len(s) and s[offset:offset + 1] == '"':
621 622 parts[-1] += '"'
622 623 offset += 1
623 624 else:
General Comments 0
You need to be logged in to leave comments. Login now