diff dwtx/jface/text/rules/RuleBasedPartitioner.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 b6bad70d540a
line wrap: on
line diff
--- a/dwtx/jface/text/rules/RuleBasedPartitioner.d	Sun Aug 24 01:29:22 2008 +0200
+++ b/dwtx/jface/text/rules/RuleBasedPartitioner.d	Sun Aug 24 01:46:20 2008 +0200
@@ -333,7 +333,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) &&
                                 (!d.containsPosition(fPositionCategory, start, length) ||
@@ -372,7 +372,7 @@
 
             TypedPosition p;
             while (first < category.length) {
-                p= (TypedPosition) category[first++];
+                p= cast(TypedPosition) category[first++];
                 d.removePosition(fPositionCategory, p);
                 rememberRegion(p.offset, p.length);
             }
@@ -408,13 +408,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) {
@@ -452,7 +452,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());
@@ -460,7 +460,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());
 
@@ -468,7 +468,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());
 
@@ -524,7 +524,7 @@
     protected String getTokenContentType(IToken token) {
         Object data= token.getData();
         if (data instanceof String)
-            return (String) data;
+            return cast(String) data;
         return null;
     }
 
@@ -576,7 +576,7 @@
 
             for (int i= 0; i < category.length; i++) {
 
-                current= (TypedPosition) category[i];
+                current= cast(TypedPosition) category[i];
 
                 gapOffset= (previous !is null) ? previous.getOffset() + previous.getLength() : 0;
                 gap= new Position(gapOffset, current.getOffset() - gapOffset);