Mercurial > hg
changeset 25784:33e613687dab
templater: remove processing of "string" literals from tokenizer
They are processed as "template" strings now.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Jun 2015 13:28:21 +0900 |
parents | 1f6878c87c25 |
children | f976b7dc5e7b |
files | mercurial/templater.py |
diffstat | 1 files changed, 5 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templater.py Mon Jun 15 23:11:35 2015 +0900 +++ b/mercurial/templater.py Sun Jun 21 13:28:21 2015 +0900 @@ -22,7 +22,6 @@ ")": (0, None, None), "integer": (0, ("integer",), None), "symbol": (0, ("symbol",), None), - "string": (0, ("template",), None), "rawstring": (0, ("rawstring",), None), "template": (0, ("template",), None), "end": (0, None, None), @@ -41,26 +40,17 @@ data, pos = _parsetemplate(program, s, end, c) yield ('template', data, s) pos -= 1 - elif (c in '"\'' or c == 'r' and - program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings - if c == 'r': - pos += 1 - c = program[pos] - decode = False - else: - decode = True - pos += 1 - s = pos + elif c == 'r' and program[pos:pos + 2] in ("r'", 'r"'): + # handle quoted strings + c = program[pos + 1] + s = pos = pos + 2 while pos < end: # find closing quote d = program[pos] if d == '\\': # skip over escaped characters pos += 2 continue if d == c: - if not decode: - yield ('rawstring', program[s:pos], s) - break - yield ('string', program[s:pos], s) + yield ('rawstring', program[s:pos], s) break pos += 1 else: