Description
This issue was originally created at: 2015-02-22 01:21:11.
This issue was reported by: russel
.
russel said at 2015-02-22 01:21:11
This report was sent to me via email:
Further, I've tracked down another bug in SCons/Scanner/D.py
:
The regexp https://bitbucket.org/per_nordlow/scons/src/7e4dd9c8304d8f197c0261df4ff18423f02775d9/src/engine/SCons/Scanner/D.py?at=default#cl-50 (note: bitbucket gone, assuming it meant this one:
Line 43 in c452f92
doesn't cover patterns such as
import IMPORT_PATH* : SYMBOL*;
only
import IMPORT_PATH;
I'm guessing both regex (self.cre
) and self.cre2
needs to be fixed right? But I don't quite understand how they are related. My guess is that self.cre
matches the whole import statements and self.cre2
matches parts of it. Am I correct? If so self.cre2
needs to be correct to handle cases such as
import X, *Y, Z;*
Do you have any idea how to fix the regexps so that it handles these cases?
My first try is to change
p = 'import\s+(?:[a-zA-Z0-9_.]+)\s*(?:,\s*(?:[a-zA-Z0-9_.]+)\s*)*;'
to
p = 'import\s+(?:[a-zA-Z0-9_.]+)\s*(?:,\s*(?:[a-zA-Z0-9_.]+)*(?:\s*:\s*[a-zA-Z0-9_.]+)?*\s*)*;'
Python:
import re
re.match(p, "import first : f")
re.match(p, "import first : f, second : g;")
but it doesn't work. I've tried debugging this, but in vain. Something about regexp operator associativity.