summaryrefslogtreecommitdiffstats
path: root/hwdb.d/ids_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'hwdb.d/ids_parser.py')
-rwxr-xr-xhwdb.d/ids_parser.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/hwdb.d/ids_parser.py b/hwdb.d/ids_parser.py
index 0ce79cd97e..811c12559b 100755
--- a/hwdb.d/ids_parser.py
+++ b/hwdb.d/ids_parser.py
@@ -6,7 +6,7 @@ import sys
from pyparsing import (Word, White, Literal, Regex,
LineEnd, SkipTo,
ZeroOrMore, OneOrMore, Combine, Optional, Suppress,
- Group,
+ Group, ParserElement,
stringEnd, pythonStyleComment)
EOL = LineEnd().suppress()
@@ -20,6 +20,8 @@ COMMENTLINE = pythonStyleComment + EOL
EMPTYLINE = LineEnd()
text_eol = lambda name: Regex(r'[^\n]+')(name) + EOL
+ParserElement.set_default_whitespace_chars(' \n')
+
def klass_grammar():
klass_line = Literal('C ').suppress() + NUM2('klass') + text_eol('text')
subclass_line = TAB + NUM2('subclass') + text_eol('text')
@@ -35,8 +37,12 @@ def klass_grammar():
def usb_ids_grammar():
vendor_line = NUM4('vendor') + text_eol('text')
device_line = TAB + NUM4('device') + text_eol('text')
+ interface_line = TAB + TAB + NUM4('interface') + NUM4('interface2') + text_eol('text')
+ device = (device_line +
+ ZeroOrMore(Group(interface_line)
+ ^ COMMENTLINE.suppress()))
vendor = (vendor_line('VENDOR') +
- ZeroOrMore(Group(device_line)('VENDOR_DEV*') ^ COMMENTLINE.suppress()))
+ ZeroOrMore(Group(device)('VENDOR_DEV*') ^ COMMENTLINE.suppress()))
klass = klass_grammar()