Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ab80f6d3
Commit
ab80f6d3
authored
Mar 16, 2001
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate and implement setPosition opcode. No runtime error actually uses
the position info yet, though.
parent
e035757c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+4
-0
lib/python/TAL/TALInterpreter.py
lib/python/TAL/TALInterpreter.py
+6
-2
No files found.
lib/python/TAL/TALGenerator.py
View file @
ab80f6d3
...
...
@@ -339,10 +339,14 @@ class TALGenerator:
if n > 1:
raise TALError("
at
most
one
of
content
,
replace
,
repeat
",
position)
repeatWhitespace = None
if repeat:
# Hack to include preceding whitespace in the loop program
repeatWhitespace = self.unEmitNewlineWhitespace()
if position != (None, None):
# XXX at some point we should insist on a non-trivial position
self.emit("
setPosition
", position)
if defineMacro:
self.pushProgram()
todo["
defineMacro
"] = defineMacro
...
...
lib/python/TAL/TALInterpreter.py
View file @
ab80f6d3
...
...
@@ -128,6 +128,7 @@ class TALInterpreter:
self
.
html
=
html
self
.
slots
=
{}
self
.
currentMacro
=
None
self
.
position
=
None
,
None
# (lineno, offset)
def
__call__
(
self
):
if
self
.
html
:
...
...
@@ -164,6 +165,9 @@ class TALInterpreter:
apply
(
method
,
args
)
self
.
level
=
self
.
level
-
1
def
do_setPosition
(
self
,
position
):
self
.
position
=
position
def
do_startEndTag
(
self
,
name
,
attrList
):
if
self
.
html
and
string
.
lower
(
name
)
not
in
EMPTY_HTML_TAGS
:
self
.
do_startTag
(
name
,
attrList
)
...
...
@@ -242,8 +246,8 @@ class TALInterpreter:
if
structure
is
None
:
return
if
repldict
:
raise
TALError
(
"replace structure with attribute replacements not yet implemented"
)
raise
TALError
(
"replace structure with attribute replacements "
"not yet implemented"
,
self
.
position
)
text
=
str
(
structure
)
self
.
checkXMLSyntax
(
text
)
self
.
stream_write
(
text
)
# No quoting -- this is intentional
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment