Terry J. Reedy added the comment: Further changes should be aimed at actual idlelib uses. Wordstart and wordend are used once each in AutoExpand.py (and wordstart a couple of times for tag.start positions). So forget them.
Does idlelib really have indexes like "2.3 + 1c" ('2.4'), "2.3-1c" ('2.2'), and "22.33-1chars" ('22.32')? The grammar we need to parse is something like index := base modifier* # nearly always 0, 1, few 2, one 3 times, so index := base modifier{0:3} index := base modmaybe modmaybe modmaybe base := numpair | mark numpair := int '.' ( int | 'end' ) mark := 'end' | 'insert' | 'iomark' | 'my_anchor' | 'sel.first' | sel.last # parts tags but this should work modmaybe := modifier | '' modifier := ' linestart' | ' lineend' | incr incr := ' '* ('+' | '-') ' '* int ('c' | 'line') # Could change the one 'char' to 'c' Rather than parse an entire index at once, parse, interpret as position, and remove base from input. While remainder, parse, apply to position, and remove from remainder. Whether the parsing is done with base and modifier REs with groups or code or some mixture does not much matter. ---------- assignee: -> terry.reedy nosy: +terry.reedy stage: -> test needed type: -> enhancement versions: +Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18504> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com