scripts: Some minor regex cleanup
Just trying to make regex in scripts a bit more consistent. Though regex being regex this may be fruitless.
This commit is contained in:
+4
-4
@@ -420,12 +420,12 @@ def collect_dwarf_info(obj_path, tags=None, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
info_pattern = re.compile(
|
||||
'^\s*(?:<(?P<level>[^>]*)>'
|
||||
'^\s*<(?P<level>[^>]*)>'
|
||||
'\s*<(?P<off>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)'
|
||||
'|\s*<(?P<off_>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)\s*$'
|
||||
'|' '^\s*<(?P<off_>[^>]*)>'
|
||||
'\s*(?P<at>[^>:]*?)'
|
||||
'\s*:(?P<v>.*))\s*$')
|
||||
'\s*:(?P<v>.*)\s*$')
|
||||
|
||||
# collect dwarf entries
|
||||
info = co.OrderedDict()
|
||||
|
||||
+4
-4
@@ -429,12 +429,12 @@ def collect_dwarf_info(obj_path, tags=None, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
info_pattern = re.compile(
|
||||
'^\s*(?:<(?P<level>[^>]*)>'
|
||||
'^\s*<(?P<level>[^>]*)>'
|
||||
'\s*<(?P<off>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)'
|
||||
'|\s*<(?P<off_>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)\s*$'
|
||||
'|' '^\s*<(?P<off_>[^>]*)>'
|
||||
'\s*(?P<at>[^>:]*?)'
|
||||
'\s*:(?P<v>.*))\s*$')
|
||||
'\s*:(?P<v>.*)\s*$')
|
||||
|
||||
# collect dwarf entries
|
||||
info = co.OrderedDict()
|
||||
|
||||
+4
-4
@@ -420,12 +420,12 @@ def collect_dwarf_info(obj_path, tags=None, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
info_pattern = re.compile(
|
||||
'^\s*(?:<(?P<level>[^>]*)>'
|
||||
'^\s*<(?P<level>[^>]*)>'
|
||||
'\s*<(?P<off>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)'
|
||||
'|\s*<(?P<off_>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)\s*$'
|
||||
'|' '^\s*<(?P<off_>[^>]*)>'
|
||||
'\s*(?P<at>[^>:]*?)'
|
||||
'\s*:(?P<v>.*))\s*$')
|
||||
'\s*:(?P<v>.*)\s*$')
|
||||
|
||||
# collect dwarf entries
|
||||
info = co.OrderedDict()
|
||||
|
||||
+13
-14
@@ -447,22 +447,21 @@ def collect_dwarf_lines(obj_path, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
line_pattern = re.compile(
|
||||
'^\s*(?:'
|
||||
# matches dir/file table
|
||||
'(?P<no>[0-9]+)'
|
||||
# matches dir/file table
|
||||
'^\s*(?P<no>[0-9]+)'
|
||||
'(?:\s+(?P<dir>[0-9]+))?'
|
||||
'.*\s+(?P<path>[^\s]+)'
|
||||
'.*\s+(?P<path>[^\s]+)\s*$'
|
||||
# matches line opcodes
|
||||
'|' '\[[^\]]*\]\s+' '(?:'
|
||||
'(?P<op_special>Special)'
|
||||
'|' '(?P<op_copy>Copy)'
|
||||
'|' '(?P<op_end>End of Sequence)'
|
||||
'|' 'File .*?to (?:entry )?(?P<op_file>\d+)'
|
||||
'|' 'Line .*?to (?P<op_line>[0-9]+)'
|
||||
'|' '(?:Address|PC) .*?to (?P<op_addr>[0x0-9a-fA-F]+)'
|
||||
'|' '.'
|
||||
')*'
|
||||
')\s*$', re.IGNORECASE)
|
||||
'|' '^\s*\[[^\]]*\]' '(?:'
|
||||
'\s+(?P<op_special>Special)'
|
||||
'|' '\s+(?P<op_copy>Copy)'
|
||||
'|' '\s+(?P<op_end>End of Sequence)'
|
||||
'|' '\s+File.*?to.*?(?P<op_file>[0-9]+)'
|
||||
'|' '\s+Line.*?to.*?(?P<op_line>[0-9]+)'
|
||||
'|' '\s+(?:Address|PC)'
|
||||
'\s+.*?to.*?(?P<op_addr>[0xX0-9a-fA-F]+)'
|
||||
'|' '\s+[^\s]+' ')+\s*$',
|
||||
re.IGNORECASE)
|
||||
|
||||
# state machine for dwarf line numbers, note that objdump's
|
||||
# decodedline seems to have issues with multiple dir/file
|
||||
|
||||
+13
-14
@@ -352,22 +352,21 @@ def collect_dwarf_lines(obj_path, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
line_pattern = re.compile(
|
||||
'^\s*(?:'
|
||||
# matches dir/file table
|
||||
'(?P<no>[0-9]+)'
|
||||
# matches dir/file table
|
||||
'^\s*(?P<no>[0-9]+)'
|
||||
'(?:\s+(?P<dir>[0-9]+))?'
|
||||
'.*\s+(?P<path>[^\s]+)'
|
||||
'.*\s+(?P<path>[^\s]+)\s*$'
|
||||
# matches line opcodes
|
||||
'|' '\[[^\]]*\]\s+' '(?:'
|
||||
'(?P<op_special>Special)'
|
||||
'|' '(?P<op_copy>Copy)'
|
||||
'|' '(?P<op_end>End of Sequence)'
|
||||
'|' 'File .*?to (?:entry )?(?P<op_file>\d+)'
|
||||
'|' 'Line .*?to (?P<op_line>[0-9]+)'
|
||||
'|' '(?:Address|PC) .*?to (?P<op_addr>[0x0-9a-fA-F]+)'
|
||||
'|' '.'
|
||||
')*'
|
||||
')\s*$', re.IGNORECASE)
|
||||
'|' '^\s*\[[^\]]*\]' '(?:'
|
||||
'\s+(?P<op_special>Special)'
|
||||
'|' '\s+(?P<op_copy>Copy)'
|
||||
'|' '\s+(?P<op_end>End of Sequence)'
|
||||
'|' '\s+File.*?to.*?(?P<op_file>[0-9]+)'
|
||||
'|' '\s+Line.*?to.*?(?P<op_line>[0-9]+)'
|
||||
'|' '\s+(?:Address|PC)'
|
||||
'\s+.*?to.*?(?P<op_addr>[0xX0-9a-fA-F]+)'
|
||||
'|' '\s+[^\s]+' ')+\s*$',
|
||||
re.IGNORECASE)
|
||||
|
||||
# state machine for dwarf line numbers, note that objdump's
|
||||
# decodedline seems to have issues with multiple dir/file
|
||||
|
||||
+4
-4
@@ -317,12 +317,12 @@ def collect_dwarf_info(obj_path, tags=None, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
info_pattern = re.compile(
|
||||
'^\s*(?:<(?P<level>[^>]*)>'
|
||||
'^\s*<(?P<level>[^>]*)>'
|
||||
'\s*<(?P<off>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)'
|
||||
'|\s*<(?P<off_>[^>]*)>'
|
||||
'.*\(\s*(?P<tag>[^)]*?)\s*\)\s*$'
|
||||
'|' '^\s*<(?P<off_>[^>]*)>'
|
||||
'\s*(?P<at>[^>:]*?)'
|
||||
'\s*:(?P<v>.*))\s*$')
|
||||
'\s*:(?P<v>.*)\s*$')
|
||||
|
||||
# collect dwarf entries
|
||||
info = co.OrderedDict()
|
||||
|
||||
Reference in New Issue
Block a user