Mercurial > projects > dwt-addons
diff dwtx/jface/text/rules/PatternRule.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | f70d9508c95c |
children | eb98a5cbfd78 |
line wrap: on
line diff
--- a/dwtx/jface/text/rules/PatternRule.d Wed Aug 27 14:49:30 2008 +0200 +++ b/dwtx/jface/text/rules/PatternRule.d Mon Sep 08 00:51:37 2008 +0200 @@ -69,7 +69,7 @@ */ private static class DecreasingCharArrayLengthComparator : Comparator { public int compare(Object o1, Object o2) { - return ((char[]) o2).length - ((char[]) o1).length; + return stringcast( o2).length - stringcast( o1).length; } } @@ -83,7 +83,7 @@ /** The pattern's end sequence */ protected char[] fEndSequence; /** The pattern's column constrain */ - protected int fColumn= UNDEFINED; + protected int fColumn; /** The pattern's escape character */ protected char fEscapeCharacter; /** @@ -100,7 +100,7 @@ * Line delimiter comparator which orders according to decreasing delimiter length. * @since 3.1 */ - private Comparator fLineDelimiterComparator= new DecreasingCharArrayLengthComparator(); + private Comparator fLineDelimiterComparator; /** * Cached line delimiters. * @since 3.1 @@ -125,9 +125,12 @@ * @param breaksOnEOL indicates whether the end of the line also terminates the pattern */ public this(String startSequence, String endSequence, IToken token, char escapeCharacter, bool breaksOnEOL) { + fColumn= UNDEFINED; + fLineDelimiterComparator= new DecreasingCharArrayLengthComparator(); + Assert.isTrue(startSequence !is null && startSequence.length() > 0); Assert.isTrue(endSequence !is null || breaksOnEOL); - Assert.isNotNull(token); + Assert.isNotNull(cast(Object)token); fStartSequence= startSequence.toCharArray(); fEndSequence= (endSequence is null ? new char[0] : endSequence.toCharArray()); @@ -256,7 +259,7 @@ char[][] originalDelimiters= scanner.getLegalLineDelimiters(); int count= originalDelimiters.length; if (fLineDelimiters is null || originalDelimiters.length !is count) { - fSortedLineDelimiters= new char[count][]; + fSortedLineDelimiters= new char[][](count); } else { while (count > 0 && fLineDelimiters[count-1] is originalDelimiters[count-1]) count--; @@ -294,7 +297,7 @@ } readCount++; } - + if (fBreaksOnEOF) return true;