summaryrefslogtreecommitdiff
path: root/keyboard
diff options
context:
space:
mode:
authormbarkhau <mbarkhau@gmail.com>2016-03-29 18:35:47 +0200
committermbarkhau <mbarkhau@gmail.com>2016-03-29 18:35:47 +0200
commit77fa2b0056f10c079af541a746fb12cb96fabe72 (patch)
tree9de8e7401db4907d294e0984972117a1f94df5c8 /keyboard
parenta2d3c0bd93bf97264bb94510c126d4fd21b7b135 (diff)
Update compile_keymap.py
Diffstat (limited to 'keyboard')
-rw-r--r--keyboard/ergodox_ez/keymaps/german-manuneo/compile_keymap.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/keyboard/ergodox_ez/keymaps/german-manuneo/compile_keymap.py b/keyboard/ergodox_ez/keymaps/german-manuneo/compile_keymap.py
index 9767b1e074..af68672226 100644
--- a/keyboard/ergodox_ez/keymaps/german-manuneo/compile_keymap.py
+++ b/keyboard/ergodox_ez/keymaps/german-manuneo/compile_keymap.py
@@ -121,32 +121,30 @@ def loads(raw_data):
// # start of the comment
(.*) # the comment
$ # until the end of line
- """, re.MULTILINE | re.VERBOSE
- )
-
+ """, re.MULTILINE | re.VERBOSE)
+
INLINE_COMMENT_RE = re.compile(r"""
- (?:[\,\"\[\]\{\}\d]) # anythig that might end a expression
+ ([\,\"\[\]\{\}\d]) # anythig that might end a expression
\s+ # comment must be preceded by whitespace
// # start of the comment
\s # and succeded by whitespace
- ([^\"\]\}\{\[]*) # the comment (except things which might be json)
+ (?:[^\"\]\}\{\[]*) # the comment (except things which might be json)
$ # until the end of line
- """, re.MULTILINE | re.VERBOSE
- )
-
+ """, re.MULTILINE | re.VERBOSE)
+
TRAILING_COMMA_RE = re.compile(r"""
, # the comma
- \s* # arbitrary whitespace (including newlines)
+ (?:\s*) # arbitrary whitespace
+ $ # only works if the trailing comma is followed by newline
+ (\s*) # arbitrary whitespace
([\]\}]) # end of an array or object
- """, re.MULTILINE | re.VERBOSE
- )
-
+ """, re.MULTILINE | re.VERBOSE)
if isinstance(raw_data, bytes):
raw_data = raw_data.decode('utf-8')
raw_data = ONELINE_COMMENT_RE.sub(r"", raw_data)
raw_data = INLINE_COMMENT_RE.sub(r"\1", raw_data)
- raw_data = TRAILING_COMMA_RE.sub(r"\1", raw_data)
+ raw_data = TRAILING_COMMA_RE.sub(r"\1\2", raw_data)
return json.loads(raw_data)