Mercurial > projects > dwt-addons
diff dwtx/jface/text/FindReplaceDocumentAdapter.d @ 140:26688fec6d23
Following dsss compile errors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 03:23:46 +0200 |
parents | 6dcb0baaa031 |
children | 000f9136b8f7 |
line wrap: on
line diff
--- a/dwtx/jface/text/FindReplaceDocumentAdapter.d Sun Aug 24 02:31:41 2008 +0200 +++ b/dwtx/jface/text/FindReplaceDocumentAdapter.d Sun Aug 24 03:23:46 2008 +0200 @@ -217,7 +217,7 @@ * The match offset from the last findReplace call. */ private int fFindReplaceMatchOffset; - + /** * Retain case mode */ @@ -350,7 +350,7 @@ int offset= fFindReplaceMatcher.start(); int length= fFindReplaceMatcher.group().length(); - if (fDocument instanceof IRepairableDocumentExtension + if (cast(IRepairableDocumentExtension)fDocument && (cast(IRepairableDocumentExtension)fDocument).isLineInformationRepairNeeded(offset, length, replaceText)) { String message= TextMessages.getString("FindReplaceDocumentAdapter.incompatibleLineDelimiter"); //$NON-NLS-1$ throw new PatternSyntaxException(message, replaceText, offset); @@ -403,7 +403,7 @@ /** * Substitutes \R in a regex find pattern with (?>\r\n?|\n) - * + * * @param findString the original find pattern * @return the transformed find pattern * @throws PatternSyntaxException if \R is added at an illegal position (e.g. in a character set) @@ -412,7 +412,7 @@ private String substituteLinebreak(String findString) { int length= findString.length(); StringBuffer buf= new StringBuffer(length); - + int inCharGroup= 0; int inBraces= 0; bool inQuote= false; @@ -424,25 +424,25 @@ if (! inQuote) inCharGroup++; break; - + case ']': buf.append(ch); if (! inQuote) inCharGroup--; break; - + case '{': buf.append(ch); if (! inQuote && inCharGroup is 0) inBraces++; break; - + case '}': buf.append(ch); if (! inQuote && inCharGroup is 0) inBraces--; break; - + case '\\': if (i + 1 < length) { char ch1= findString.charAt(i + 1); @@ -451,7 +451,7 @@ inQuote= false; buf.append(ch).append(ch1); i++; - + } else if (ch1 is 'R') { if (inCharGroup > 0 || inBraces > 0) { String msg= TextMessages.getString("FindReplaceDocumentAdapter.illegalLinebreak"); //$NON-NLS-1$ @@ -459,7 +459,7 @@ } buf.append("(?>\\r\\n?|\\n)"); //$NON-NLS-1$ i++; - + } else { if (ch1 is 'Q') { inQuote= true; @@ -471,20 +471,20 @@ buf.append(ch); } break; - + default: buf.append(ch); break; } - + } return buf.toString(); } - + /** * Interprets current Retain Case mode (all upper-case,all lower-case,capitalized or mixed) * and appends the character <code>ch</code> to <code>buf</code> after processing. - * + * * @param buf the output buffer * @param ch the character to process * @since 3.4 @@ -503,7 +503,7 @@ /** * Interprets escaped characters in the given replace pattern. - * + * * @param replaceText the replace pattern * @param foundText the found pattern to be replaced * @return a replace pattern with escaped characters substituted by the respective characters @@ -513,21 +513,21 @@ int length= replaceText.length(); bool inEscape= false; StringBuffer buf= new StringBuffer(length); - + /* every string we did not check looks mixed at first * so initialize retain case mode with RC_MIXED */ fRetainCaseMode= RC_MIXED; - + for (int i= 0; i < length; i++) { final char ch= replaceText.charAt(i); if (inEscape) { i= interpretReplaceEscape(ch, i, buf, replaceText, foundText); inEscape= false; - + } else if (ch is '\\') { inEscape= true; - + } else if (ch is '$') { buf.append(ch); @@ -553,7 +553,7 @@ interpretRetainCase(buf, ch); } } - + if (inEscape) { // '\' as last character is invalid, but we still add it to get an error message buf.append('\\'); @@ -564,7 +564,7 @@ /** * Interprets the escaped character <code>ch</code> at offset <code>i</code> * of the <code>replaceText</code> and appends the interpretation to <code>buf</code>. - * + * * @param ch the escaped character * @param i the offset * @param buf the output buffer @@ -614,7 +614,7 @@ } } break; - + case '1': case '2': case '3': @@ -637,7 +637,7 @@ throw new PatternSyntaxException(msg, replaceText, i); } break; - + case 'x': if (i + 2 < length) { int parsedInt; @@ -656,7 +656,7 @@ throw new PatternSyntaxException(msg, replaceText, i); } break; - + case 'u': if (i + 4 < length) { int parsedInt; @@ -675,7 +675,7 @@ throw new PatternSyntaxException(msg, replaceText, i); } break; - + case 'C': if(foundText.toUpperCase().equals(foundText)) // is whole match upper-case? fRetainCaseMode= RC_UPPER; @@ -703,29 +703,29 @@ * @return the string converted to a regex pattern */ private String asRegPattern(String string) { - StringBuffer out= new StringBuffer(string.length()); + StringBuffer out_= new StringBuffer(string.length()); bool quoting= false; for (int i= 0, length= string.length(); i < length; i++) { char ch= string.charAt(i); if (ch is '\\') { if (quoting) { - out.append("\\E"); //$NON-NLS-1$ + out_.append("\\E"); //$NON-NLS-1$ quoting= false; } - out.append("\\\\"); //$NON-NLS-1$ + out_.append("\\\\"); //$NON-NLS-1$ continue; } if (!quoting) { - out.append("\\Q"); //$NON-NLS-1$ + out_.append("\\Q"); //$NON-NLS-1$ quoting= true; } - out.append(ch); + out_.append(ch); } if (quoting) - out.append("\\E"); //$NON-NLS-1$ + out_.append("\\E"); //$NON-NLS-1$ - return out.toString(); + return out_.toString(); } /**