Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rtamt/pastifier/ltl/pastifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class LtlPastifier(LtlAstVisitor):

def __init__(self):
self.subformula_horizons = dict()
self.ast = None

def pastify(self, ast):
self.ast = ast
h = LtlHorizon()
horizons = dict()
for spec in ast.specs:
Expand All @@ -46,9 +48,17 @@ def pastify(self, ast):
horizon = horizons[spec]
pastified_spec = self.visit(spec, horizon)
pastified_specs.append(pastified_spec)
ast.phi_name_to_node_dict = self.ast.phi_name_to_node_dict
ast.specs = pastified_specs
return ast

def visit(self, node, *args, **kwargs):
out = LtlAstVisitor.visit(self, node, *args, **kwargs)
d = self.ast.phi_name_to_node_dict
keys = [k for k, v in d.items() if v == node]
self.ast.phi_name_to_node_dict.update({key: out for key in keys})
return out

def visitConstant(self, node, *args, **kwargs):
node = Constant(node.val)
return node
Expand Down
8 changes: 7 additions & 1 deletion rtamt/pastifier/stl/pastifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self):
self.node_horizons = dict()

def pastify(self, ast):
self.ast = ast
h = StlHorizon()
horizons = dict()
for spec in ast.specs:
Expand All @@ -54,10 +55,15 @@ def pastify(self, ast):
pastified_spec = self.visit(spec, horizon)
pastified_specs.append(pastified_spec)
ast.specs = pastified_specs
ast.phi_name_to_node_dict = self.ast.phi_name_to_node_dict
return ast

def visit(self, node, *args, **kwargs):
return StlAstVisitor.visit(self, node, *args, **kwargs)
out = StlAstVisitor.visit(self, node, *args, **kwargs)
d = self.ast.phi_name_to_node_dict
keys = [k for k, v in d.items() if v == node]
self.ast.phi_name_to_node_dict.update({key: out for key in keys})
return out

def visitVariable(self, node, *args, **kwargs):
horizon = args[0]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='rtamt',
version='0.4.9',
version='0.4.10',
description='Library for specification-based online monitoring.',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
Loading