Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7764/src/org/python/pydev/editor/actions
Modified Files:
PyFormatStd.java
Log Message:
Changes in the ParsingUtils interface (creating correct version with factory to properly adapt to the object being read).
Index: PyFormatStd.java
===================================================================
RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyFormatStd.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** PyFormatStd.java 15 Jun 2008 16:45:26 -0000 1.17
--- PyFormatStd.java 6 Jul 2008 21:58:13 -0000 1.18
***************
*** 127,130 ****
--- 127,131 ----
char[] cs = str.toCharArray();
FastStringBuffer buf = new FastStringBuffer();
+ ParsingUtils parsingUtils = ParsingUtils.create(cs);
char lastChar = '\0';
for (int i = 0; i < cs.length; i++) {
***************
*** 132,139 ****
if (c == '\'' || c == '"') { //ignore comments or multiline comments...
! i = ParsingUtils.eatLiterals(cs, buf, i);
} else if (c == '#') {
! i = ParsingUtils.eatComments(cs, buf, i);
} else if (c == ',') {
--- 133,140 ----
if (c == '\'' || c == '"') { //ignore comments or multiline comments...
! i = parsingUtils.eatLiterals(buf, i);
} else if (c == '#') {
! i = parsingUtils.eatComments(buf, i);
} else if (c == ',') {
***************
*** 142,146 ****
} else if (c == '(') {
! i = formatForPar(cs, i, std, buf);
} else {
--- 143,147 ----
} else if (c == '(') {
! i = formatForPar(parsingUtils, cs, i, std, buf);
} else {
***************
*** 161,165 ****
* @param i
*/
! private static int formatForPar(char[] cs, int i, FormatStd std, FastStringBuffer buf) {
char c = ' ';
FastStringBuffer locBuf = new FastStringBuffer();
--- 162,166 ----
* @param i
*/
! private static int formatForPar(ParsingUtils parsingUtils, char[] cs, int i, FormatStd std, FastStringBuffer buf) {
char c = ' ';
FastStringBuffer locBuf = new FastStringBuffer();
***************
*** 171,181 ****
if (c == '\'' || c == '"') { //ignore comments or multiline comments...
! j = ParsingUtils.eatLiterals(cs, locBuf, j - 1) + 1;
} else if (c == '#') {
! j = ParsingUtils.eatComments(cs, locBuf, j - 1) + 1;
} else if (c == '(') { //open another par.
! j = formatForPar(cs, j - 1, std, locBuf) + 1;
} else {
--- 172,182 ----
if (c == '\'' || c == '"') { //ignore comments or multiline comments...
! j = parsingUtils.eatLiterals(locBuf, j - 1) + 1;
} else if (c == '#') {
! j = parsingUtils.eatComments(locBuf, j - 1) + 1;
} else if (c == '(') { //open another par.
! j = formatForPar(parsingUtils, cs, j - 1, std, locBuf) + 1;
} else {
|