Reduce the amount of function calls in include extraction

This commit is contained in:
Thomas Nagy 2016-03-25 13:30:32 +01:00
parent df7fc838ce
commit 026bae9601
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
1 changed files with 3 additions and 3 deletions

View File

@ -651,7 +651,7 @@ def extract_macro(txt):
# empty define, assign an empty token
return (v, [[], [('T','')]])
re_include = re.compile('^\s*(<(?P<a>.*)>|"(?P<b>.*)")')
re_include = re.compile('^\s*(<(?:.*)>|"(?:.*)")')
def extract_include(txt, defs):
"""
Process a line in the form::
@ -667,8 +667,8 @@ def extract_include(txt, defs):
"""
m = re_include.search(txt)
if m:
if m.group('a'): return '<', m.group('a')
if m.group('b'): return '"', m.group('b')
txt = m.group(1)
return txt[0], txt[1:-1]
# perform preprocessing and look at the result, it must match an include
toks = tokenize(txt)