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:
...
@@ -339,10 +339,14 @@ class TALGenerator:
if n > 1:
if n > 1:
raise TALError("
at
most
one
of
content
,
replace
,
repeat
",
raise TALError("
at
most
one
of
content
,
replace
,
repeat
",
position)
position)
repeatWhitespace = None
repeatWhitespace = None
if repeat:
if repeat:
# Hack to include preceding whitespace in the loop program
# Hack to include preceding whitespace in the loop program
repeatWhitespace = self.unEmitNewlineWhitespace()
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:
if defineMacro:
self.pushProgram()
self.pushProgram()
todo["
defineMacro
"] = defineMacro
todo["
defineMacro
"] = defineMacro
...
...
lib/python/TAL/TALInterpreter.py
View file @
ab80f6d3
...
@@ -128,6 +128,7 @@ class TALInterpreter:
...
@@ -128,6 +128,7 @@ class TALInterpreter:
self
.
html
=
html
self
.
html
=
html
self
.
slots
=
{}
self
.
slots
=
{}
self
.
currentMacro
=
None
self
.
currentMacro
=
None
self
.
position
=
None
,
None
# (lineno, offset)
def
__call__
(
self
):
def
__call__
(
self
):
if
self
.
html
:
if
self
.
html
:
...
@@ -164,6 +165,9 @@ class TALInterpreter:
...
@@ -164,6 +165,9 @@ class TALInterpreter:
apply
(
method
,
args
)
apply
(
method
,
args
)
self
.
level
=
self
.
level
-
1
self
.
level
=
self
.
level
-
1
def
do_setPosition
(
self
,
position
):
self
.
position
=
position
def
do_startEndTag
(
self
,
name
,
attrList
):
def
do_startEndTag
(
self
,
name
,
attrList
):
if
self
.
html
and
string
.
lower
(
name
)
not
in
EMPTY_HTML_TAGS
:
if
self
.
html
and
string
.
lower
(
name
)
not
in
EMPTY_HTML_TAGS
:
self
.
do_startTag
(
name
,
attrList
)
self
.
do_startTag
(
name
,
attrList
)
...
@@ -242,8 +246,8 @@ class TALInterpreter:
...
@@ -242,8 +246,8 @@ class TALInterpreter:
if
structure
is
None
:
if
structure
is
None
:
return
return
if
repldict
:
if
repldict
:
raise
TALError
(
raise
TALError
(
"replace structure with attribute replacements "
"replace structure with attribute replacements not yet implemented"
)
"not yet implemented"
,
self
.
position
)
text
=
str
(
structure
)
text
=
str
(
structure
)
self
.
checkXMLSyntax
(
text
)
self
.
checkXMLSyntax
(
text
)
self
.
stream_write
(
text
)
# No quoting -- this is intentional
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