##// END OF EJS Templates
templater: check existence of closing brace of template string
Yuya Nishihara -
r25782:babd2c93 default
parent child Browse files
Show More
@@ -120,12 +120,12 b' def tokenize(program, start, end):'
120 yield ('symbol', sym, s)
120 yield ('symbol', sym, s)
121 pos -= 1
121 pos -= 1
122 elif c == '}':
122 elif c == '}':
123 pos += 1
123 yield ('end', None, pos + 1)
124 break
124 return
125 else:
125 else:
126 raise error.ParseError(_("syntax error"), pos)
126 raise error.ParseError(_("syntax error"), pos)
127 pos += 1
127 pos += 1
128 yield ('end', None, pos)
128 raise error.ParseError(_("unterminated template expansion"), start)
129
129
130 def _parsetemplate(tmpl, start, stop):
130 def _parsetemplate(tmpl, start, stop):
131 parsed = []
131 parsed = []
@@ -2513,6 +2513,10 b' Error on syntax:'
2513 abort: t:3: unmatched quotes
2513 abort: t:3: unmatched quotes
2514 [255]
2514 [255]
2515
2515
2516 $ hg log -T '{date'
2517 hg: parse error at 1: unterminated template expansion
2518 [255]
2519
2516 Behind the scenes, this will throw TypeError
2520 Behind the scenes, this will throw TypeError
2517
2521
2518 $ hg log -l 3 --template '{date|obfuscate}\n'
2522 $ hg log -l 3 --template '{date|obfuscate}\n'
General Comments 0
You need to be logged in to leave comments. Login now