diff dwtx/jface/text/rules/FastPartitioner.d @ 134:51e6e63f930e

Regex fix for casts
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 01:46:20 +0200
parents 7d818bd32d63
children 6dcb0baaa031
line wrap: on
line diff
--- a/dwtx/jface/text/rules/FastPartitioner.d	Sun Aug 24 01:29:22 2008 +0200
+++ b/dwtx/jface/text/rules/FastPartitioner.d	Sun Aug 24 01:46:20 2008 +0200
@@ -333,7 +333,7 @@
 
             int first= fDocument.computeIndexInCategory(fPositionCategory, reparseStart);
             if (first > 0)  {
-                TypedPosition partition= (TypedPosition) category[first - 1];
+                TypedPosition partition= cast(TypedPosition) category[first - 1];
                 if (partition.includes(reparseStart)) {
                     partitionStart= partition.getOffset();
                     contentType= partition.getType();
@@ -384,7 +384,7 @@
 
                 // remove all affected positions
                 while (first < category.length) {
-                    TypedPosition p= (TypedPosition) category[first];
+                    TypedPosition p= cast(TypedPosition) category[first];
                     if (lastScannedPosition >= p.offset + p.length ||
                             (p.overlapsWith(start, length) &&
                                 (!fDocument.containsPosition(fPositionCategory, start, length) ||
@@ -423,7 +423,7 @@
             category= getPositions();
             TypedPosition p;
             while (first < category.length) {
-                p= (TypedPosition) category[first++];
+                p= cast(TypedPosition) category[first++];
                 fDocument.removePosition(fPositionCategory, p);
                 rememberRegion(p.offset, p.length);
             }
@@ -462,13 +462,13 @@
 
             if (index < category.length) {
                 if (offset is category[index].offset)
-                    return (TypedPosition) category[index];
+                    return cast(TypedPosition) category[index];
             }
 
             if (index > 0)
                 index--;
 
-            return (TypedPosition) category[index];
+            return cast(TypedPosition) category[index];
 
         } catch (BadPositionCategoryException x) {
         } catch (BadLocationException x) {
@@ -514,7 +514,7 @@
 
             if (index < category.length) {
 
-                TypedPosition next= (TypedPosition) category[index];
+                TypedPosition next= cast(TypedPosition) category[index];
 
                 if (offset is next.offset)
                     return new TypedRegion(next.getOffset(), next.getLength(), next.getType());
@@ -522,7 +522,7 @@
                 if (index is 0)
                     return new TypedRegion(0, next.offset, IDocument.DEFAULT_CONTENT_TYPE);
 
-                TypedPosition previous= (TypedPosition) category[index - 1];
+                TypedPosition previous= cast(TypedPosition) category[index - 1];
                 if (previous.includes(offset))
                     return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType());
 
@@ -530,7 +530,7 @@
                 return new TypedRegion(endOffset, next.getOffset() - endOffset, IDocument.DEFAULT_CONTENT_TYPE);
             }
 
-            TypedPosition previous= (TypedPosition) category[category.length - 1];
+            TypedPosition previous= cast(TypedPosition) category[category.length - 1];
             if (previous.includes(offset))
                 return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType());
 
@@ -595,7 +595,7 @@
     protected String getTokenContentType(IToken token) {
         Object data= token.getData();
         if (data instanceof String)
-            return (String) data;
+            return cast(String) data;
         return null;
     }
 
@@ -656,7 +656,7 @@
             int endIndex= getFirstIndexStartingAfterOffset(category, endOffset);
             for (int i= startIndex; i < endIndex; i++) {
 
-                current= (TypedPosition) category[i];
+                current= cast(TypedPosition) category[i];
 
                 gapOffset= (previous !is null) ? previous.getOffset() + previous.getLength() : 0;
                 gap.setOffset(gapOffset);
@@ -824,7 +824,7 @@
     protected final Position[] getPositions() throws BadPositionCategoryException {
         if (fCachedPositions is null) {
             fCachedPositions= fDocument.getPositions(fPositionCategory);
-        } else if (CHECK_CACHE_CONSISTENCY) {
+        } else if cast(CHECK_CACHE_CONSISTENCY) {
             Position[] positions= fDocument.getPositions(fPositionCategory);
             int len= Math.min(positions.length, fCachedPositions.length);
             for (int i= 0; i < len; i++) {