Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
1745f726
Commit
1745f726
authored
Dec 01, 2013
by
Andreas Freise
Browse files
adding tags to commands based on FTblock/FTend.
parent
e940d8bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
pykat/finesse.py
View file @
1745f726
...
...
@@ -121,23 +121,25 @@ class kat(object):
def
parseCommands
(
self
,
commands
):
blockComment
=
False
currentTag
=
""
self
.
__
currentTag
=
""
for
line
in
commands
.
split
(
"
\n
"
):
if
len
(
line
.
strip
())
>=
2
:
line
=
line
.
strip
()
# Looking for block start or end
if
line
[
0
:
3
]
==
"%%%"
:
values
=
text
.
split
(
" "
)
values
=
line
.
split
(
" "
)
if
values
[
0
]
==
"%%%"
:
if
values
[
1
]
==
"FTblock"
:
newTag
=
values
[
2
]
if
newTag
!=
self
.
__currentTag
and
self
.
__currentTag
:
warnings
.
warn
(
"found block {0} before block {1} ended"
.
format
(
newTag
,
self
.
__currentTag
))
self
.
__currentTag
=
newTag
if
values
[
1
]
==
"FTend"
:
if
currentTag
!=
values
[
2
]:
warnings
.
warn
(
"Found FTend {0} but expected block {1) to end"
.
format
(
values
[
2
],
currentTag
))
currentTag
=
""
self
.
__currentTag
=
""
continue
#warnings.warn("current tag {0}".format(self.__currentTag))
# don't read comment lines
if
line
[
0
]
==
"#"
or
line
[
0
]
==
"%"
:
continue
...
...
@@ -163,6 +165,7 @@ class kat(object):
else
:
print
"Parsing `{0}` into pykat object not implemented yet, added as extra line."
.
format
(
line
)
self
.
__extra_lines
.
append
(
line
+
"
\n
"
)
self
.
__currentTag
=
""
def
run
(
self
,
printout
=
1
,
printerr
=
1
,
save_output
=
False
,
save_kat
=
False
,
kat_name
=
None
)
:
"""
...
...
@@ -295,6 +298,7 @@ class kat(object):
def
add
(
self
,
obj
)
:
try
:
obj
.
tag
=
self
.
__currentTag
if
isinstance
(
obj
,
Component
):
if
obj
.
name
in
self
.
__components
:
...
...
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