@@ -344,12 +344,12 @@ class Text(_Element):
344344 ESCAPED_CHAR = re .compile (r'\\([\$#]\S+)' )
345345
346346 def parse (self ):
347- text , = self .identity_match (self .PLAIN )
347+ raw , = self .identity_match (self .PLAIN )
348348
349349 def unescape (match ):
350350 return match .group (1 )
351351
352- self .text = self .ESCAPED_CHAR .sub (unescape , text )
352+ self .text = self .ESCAPED_CHAR .sub (unescape , raw )
353353
354354 def evaluate_raw (self , stream , namespace , loader ):
355355 stream .write (self .text )
@@ -375,8 +375,8 @@ class IntegerLiteral(_Element):
375375 INTEGER = re .compile (r'(-?\d+)(.*)' , re .S )
376376
377377 def parse (self ):
378- self . value , = self .identity_match (self .INTEGER )
379- self .value = int (self . value )
378+ raw , = self .identity_match (self .INTEGER )
379+ self .value = int (raw )
380380
381381 def calculate (self , namespace , loader ):
382382 return self .value
@@ -386,8 +386,8 @@ class FloatingPointLiteral(_Element):
386386 FLOAT = re .compile (r'(-?\d*\.\d+)(.*)' , re .S )
387387
388388 def parse (self ):
389- self . value , = self .identity_match (self .FLOAT )
390- self .value = float (self . value )
389+ raw , = self .identity_match (self .FLOAT )
390+ self .value = float (raw )
391391
392392 def calculate (self , namespace , loader ):
393393 return self .value
@@ -397,8 +397,8 @@ class BooleanLiteral(_Element):
397397 BOOLEAN = re .compile (r'((?:true)|(?:false))(.*)' , re .S | re .I )
398398
399399 def parse (self ):
400- self . value , = self .identity_match (self .BOOLEAN )
401- self .value = self . value .lower () == 'true'
400+ raw , = self .identity_match (self .BOOLEAN )
401+ self .value = raw .lower () == 'true'
402402
403403 def calculate (self , namespace , loader ):
404404 return self .value
@@ -756,9 +756,6 @@ class Comment(_Element, Null):
756756 def parse (self ):
757757 self .identity_match (self .COMMENT )
758758
759- def evaluate (self , * args ):
760- pass
761-
762759
763760class BinaryOperator (_Element ):
764761 BINARY_OP = re .compile (
@@ -1224,6 +1221,7 @@ def evaluate_raw(self, stream, namespace, loader):
12241221class TemplateBody (_Element ):
12251222 def parse (self ):
12261223 self .block = self .next_element (Block )
1224+ # No text should be left over
12271225 if self .next_text ():
12281226 raise self .syntax_error ('block element' )
12291227
0 commit comments