]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hwdb: add missing Group() 17734/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Nov 2020 21:00:11 +0000 (06:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Nov 2020 21:02:44 +0000 (06:02 +0900)
This fixes the following warning:
```
parse_hwdb.py:120: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'SETTINGS*' on And expression collides with 'HZ' on contained expression
  dpi_setting = (Optional('*')('DEFAULT') + INTEGER('DPI') + Suppress('@') + INTEGER('HZ'))('SETTINGS*')
```

Not sure about for the mount_matrix, but LGTM.com warns in that line,
and, adding Group() does not change the parse result.

hwdb.d/parse_hwdb.py

index 52f881623cc49d5442b80d17d63a40484c3d0a6a..d1ff4470de1cdd10af7da8cb4225faed2a8e24c1 100755 (executable)
@@ -117,9 +117,9 @@ def hwdb_grammar():
 def property_grammar():
     ParserElement.setDefaultWhitespaceChars(' ')
 
-    dpi_setting = (Optional('*')('DEFAULT') + INTEGER('DPI') + Suppress('@') + INTEGER('HZ'))('SETTINGS*')
+    dpi_setting = Group(Optional('*')('DEFAULT') + INTEGER('DPI') + Suppress('@') + INTEGER('HZ'))('SETTINGS*')
     mount_matrix_row = SIGNED_REAL + ',' + SIGNED_REAL + ',' + SIGNED_REAL
-    mount_matrix = (mount_matrix_row + ';' + mount_matrix_row + ';' + mount_matrix_row)('MOUNT_MATRIX')
+    mount_matrix = Group(mount_matrix_row + ';' + mount_matrix_row + ';' + mount_matrix_row)('MOUNT_MATRIX')
     xkb_setting = Optional(Word(alphanums + '+-/@._'))
 
     props = (('MOUSE_DPI', Group(OneOrMore(dpi_setting))),