Commit be825171 authored by Guido van Rossum's avatar Guido van Rossum

- Don't use z: prefix in references to TAL attributes in error

  messages.

- Now that splitParts() is fixed to lose the last part if it's empty,
  don't break on empty parts.
parent 72238d11
...@@ -88,7 +88,6 @@ Code generator for TALInterpreter intermediate code. ...@@ -88,7 +88,6 @@ Code generator for TALInterpreter intermediate code.
import re import re
import cgi import cgi
import string
from TALDefs import * from TALDefs import *
...@@ -151,8 +150,7 @@ class TALGenerator: ...@@ -151,8 +150,7 @@ class TALGenerator:
m = re.match( m = re.match(
r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part) r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part)
if not m: if not m:
if not string.strip(part): break # extra space after semi raise TALError("invalid define syntax: " + `part`)
raise TALError("invalid z:define syntax: " + `part`)
scope, name, expr = m.group(1, 2, 3) scope, name, expr = m.group(1, 2, 3)
scope = scope or "local" scope = scope or "local"
cexpr = self.compileExpression(expr) cexpr = self.compileExpression(expr)
...@@ -169,7 +167,7 @@ class TALGenerator: ...@@ -169,7 +167,7 @@ class TALGenerator:
def emitRepeat(self, arg): def emitRepeat(self, arg):
m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg) m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg)
if not m: if not m:
raise TALError("invalid z:repeat syntax: " + `repeat`) raise TALError("invalid repeat syntax: " + `repeat`)
name, expr = m.group(1, 2) name, expr = m.group(1, 2)
cexpr = self.compileExpression(expr) cexpr = self.compileExpression(expr)
program = self.popProgram() program = self.popProgram()
...@@ -178,7 +176,7 @@ class TALGenerator: ...@@ -178,7 +176,7 @@ class TALGenerator:
def emitSubstitution(self, arg, attrDict={}): def emitSubstitution(self, arg, attrDict={}):
key, expr = parseSubstitution(arg) key, expr = parseSubstitution(arg)
if not key: if not key:
raise TALError("Bad syntax in z:insert/z:replace: " + `arg`) raise TALError("Bad syntax in insert/replace: " + `arg`)
cexpr = self.compileExpression(expr) cexpr = self.compileExpression(expr)
program = self.popProgram() program = self.popProgram()
if key == "text": if key == "text":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment