From f955b8c50f3dd432ca07870213232753ea9940cf Mon Sep 17 00:00:00 2001 From: Philippe Groarke Date: Sat, 14 Oct 2017 13:09:29 -0400 Subject: [PATCH] check.py : Add checks for inversion and range modifiers. --- .gitignore | 2 +- check.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9084a01..1f92034 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -.bak.gamecontrollerdb.txt +.bak.*.txt .DS_Store .work \ No newline at end of file diff --git a/check.py b/check.py index 1a5c2fa..1d518da 100755 --- a/check.py +++ b/check.py @@ -60,7 +60,15 @@ def check_mapping (mappingstring): else: if not value: continue - if not value[0] in ['a', 'h', 'b']: + if value[0] in ['-', '+', '~']: + if not value[1] == 'a': + error ("Invalid value \"" + value + "\" for key \"" + key + + "\". Inversion and range modifiers only valid for " + + "axis (a).") + if not value[2:].isnumeric(): + error ("Invalid value \"" + value + "\" for key \"" + key + + "\". Should be followed by a number after 'a'") + elif not value[0] in ['a', 'h', 'b']: error ("Invalid value \"" + value + "\" for key \"" + key + "\". Should start with a, b, or h") elif value[0] in ['a', 'b']: