| summaryrefslogtreecommitdiff |
path: root/tina_converter.py
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2016-10-04 10:29:20 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2016-10-04 10:29:20 +0200 |
| commit | ae0a6eb4b51801d07e7fc24269d04cf864422a61 (patch) | |
| tree | 4d08caf5d252e9220fd263f0153cce078ea85e9b /tina_converter.py | |
| parent | 6c820c062284da16a6927393f9803c1f6b2114c7 (diff) | |
Fixes minor issues so it runs without errors.
Diffstat (limited to 'tina_converter.py')
| -rwxr-xr-x[-rw-r--r--] | tina_converter.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tina_converter.py b/tina_converter.py index d874fe4..bbd8c53 100644..100755 --- a/tina_converter.py +++ b/tina_converter.py @@ -4,7 +4,7 @@ import argparse import re -TINA_TRANSITION_REGEX = re.compile('tr t([0-9]+) : {(.*)} [0,w[ p([0-9]+) -> p([0-9]+)') +TINA_TRANSITION_REGEX = re.compile('tr t([0-9]+) : {(.*)} \[0,w\[ p([0-9]+) -> p([0-9]+)') TINA_PLACE_W_TOKEN_REGEX = re.compile('pl p([0-9]+) : .* \(([0-9]+)\)') TINA_PLACE_TOKEN_REGEX = re.compile('pl p([0-9]+) : .*') TINA_NET_REGEX = re.compile('net (.*)') @@ -46,7 +46,7 @@ ACTION['ENVOI_BT'] = (18, True) def parse_translation_table (tt_file): tt = dict() for line in tt_file: - data = line.split("::") + data = line.replace('\n','').replace('\r', '').split("::") if (len(data) == 2): # Action if (data[0] in tt): @@ -137,7 +137,7 @@ def parse_translation_table (tt_file): ) exit(-1) - tt[data[0]] = ('condition', (act_id, CONDITION_OP[data[2]], cond_val)) + tt[data[0]] = ('condition', (cond_id, CONDITION_OP[data[2]], cond_val)) else: print('[W] Ignored invalid Translation Table entry: "' + line + '"') @@ -151,6 +151,11 @@ def convert_tina_net (net_file, tt): places = dict() for line in net_file: + line = line.replace('\r','').replace('\n','') + + if (line == ''): + continue + matched = TINA_NET_REGEX.search(line) if (matched): |


