[Pydev-cvs] org.python.pydev.core/src/org/python/pydev/core/docutils ImportHandle.java, 1.3, 1.4
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-05-20 02:20:26
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10748/src/org/python/pydev/core/docutils Modified Files: ImportHandle.java Log Message: Simplified regular expression to match imports. Index: ImportHandle.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/ImportHandle.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ImportHandle.java 19 May 2008 00:58:28 -0000 1.3 --- ImportHandle.java 20 May 2008 02:20:23 -0000 1.4 *************** *** 24,29 **** //spaces* 'from' space+ module space+ import (mod as y) ! private static final Pattern FromImportPattern = Pattern.compile("(from\\s+)(\\.*\\w+)+(\\s+import\\s+)(\\w+|\\s|,|#|\\(|\\)|\\\\)*"); ! private static final Pattern ImportPattern = Pattern.compile("(import\\s+)(\\w+|\\s|,|#|\\(|\\)|\\\\)*"); /** --- 24,29 ---- //spaces* 'from' space+ module space+ import (mod as y) ! private static final Pattern FromImportPattern = Pattern.compile("(from\\s+)(\\.*\\w+)+(\\s+import\\s+)"); ! private static final Pattern ImportPattern = Pattern.compile("(import\\s+)"); /** *************** *** 87,91 **** //from import Matcher matcher = FromImportPattern.matcher(importFound); ! if(matcher.matches()){ this.fromStr = importFound.substring(matcher.end(1), matcher.end(2)).trim(); --- 87,91 ---- //from import Matcher matcher = FromImportPattern.matcher(importFound); ! if(matcher.find()){ this.fromStr = importFound.substring(matcher.end(1), matcher.end(2)).trim(); *************** *** 93,97 **** //we have to do that because the last group will only have the last match in the string String importedStr = importFound.substring(matcher.end(3), ! matcher.end(4)).trim(); buildImportedList(importedStr); --- 93,97 ---- //we have to do that because the last group will only have the last match in the string String importedStr = importFound.substring(matcher.end(3), ! importFound.length()).trim(); buildImportedList(importedStr); *************** *** 105,112 **** //regular import Matcher matcher = ImportPattern.matcher(importFound); ! if(matcher.matches()){ //we have to do that because the last group will only have the last match in the string String importedStr = importFound.substring(matcher.end(1), ! matcher.end(2)).trim(); buildImportedList(importedStr); --- 105,112 ---- //regular import Matcher matcher = ImportPattern.matcher(importFound); ! if(matcher.find()){ //we have to do that because the last group will only have the last match in the string String importedStr = importFound.substring(matcher.end(1), ! importFound.length()).trim(); buildImportedList(importedStr); |