Mercurial > public > mercurial-scm > hg
comparison mercurial/templater.py @ 14496:ffcb7e4d719f stable
revset: report a parse error if a revset is not parsed completely (issue2654)
author | Bernhard Leiner <bleiner@gmail.com> |
---|---|
date | Wed, 16 Mar 2011 23:09:14 +0100 |
parents | e3b87fb34d00 |
children | 135e244776f0 |
comparison
equal
deleted
inserted
replaced
14479:c63cc5eccbff | 14496:ffcb7e4d719f |
---|---|
67 pos += 1 | 67 pos += 1 |
68 break | 68 break |
69 else: | 69 else: |
70 raise error.ParseError(_("syntax error"), pos) | 70 raise error.ParseError(_("syntax error"), pos) |
71 pos += 1 | 71 pos += 1 |
72 data[2] = pos | |
73 yield ('end', None, pos) | 72 yield ('end', None, pos) |
74 | 73 |
75 def compiletemplate(tmpl, context): | 74 def compiletemplate(tmpl, context): |
76 parsed = [] | 75 parsed = [] |
77 pos, stop = 0, len(tmpl) | 76 pos, stop = 0, len(tmpl) |
89 continue | 88 continue |
90 if n > pos: | 89 if n > pos: |
91 parsed.append(("string", tmpl[pos:n])) | 90 parsed.append(("string", tmpl[pos:n])) |
92 | 91 |
93 pd = [tmpl, n + 1, stop] | 92 pd = [tmpl, n + 1, stop] |
94 parsed.append(p.parse(pd)) | 93 parseres, pos = p.parse(pd) |
95 pos = pd[2] | 94 parsed.append(parseres) |
96 | 95 |
97 return [compileexp(e, context) for e in parsed] | 96 return [compileexp(e, context) for e in parsed] |
98 | 97 |
99 def compileexp(exp, context): | 98 def compileexp(exp, context): |
100 t = exp[0] | 99 t = exp[0] |