mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
93619fcb12
commit
0835b4737d
7 changed files with 25 additions and 165 deletions
|
@ -770,7 +770,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (fInput.get(delimEndOffset) == '(') {
|
if (fInput.get(delimEndOffset) == '(') {
|
||||||
offset= delimEndOffset+1;
|
offset= delimEndOffset + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -784,17 +784,17 @@ final public class Lexer implements ITokenSequence {
|
||||||
|
|
||||||
final char c= fInput.get(offset);
|
final char c= fInput.get(offset);
|
||||||
if (c == ')') {
|
if (c == ')') {
|
||||||
final int endingDoubleQuoteOffset= offset+delimLength+1;
|
final int endingDoubleQuoteOffset= offset + delimLength + 1;
|
||||||
if (fInput.isValidOffset(endingDoubleQuoteOffset) && fInput.get(endingDoubleQuoteOffset) == '"') {
|
if (fInput.isValidOffset(endingDoubleQuoteOffset) && fInput.get(endingDoubleQuoteOffset) == '"') {
|
||||||
boolean prefixMatches= true;
|
boolean prefixMatches= true;
|
||||||
for (int i = 0; i < delimLength; i++) {
|
for (int i = 0; i < delimLength; i++) {
|
||||||
if (fInput.get(offset + i + 1) != fInput.get(delimOffset+i)) {
|
if (fInput.get(offset + i + 1) != fInput.get(delimOffset + i)) {
|
||||||
prefixMatches= false;
|
prefixMatches= false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prefixMatches) {
|
if (prefixMatches) {
|
||||||
offset= endingDoubleQuoteOffset+1;
|
offset= endingDoubleQuoteOffset + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,26 +28,21 @@ import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests to verify the C partitioning.
|
* Tests to verify the C partitioning.
|
||||||
* Derived from JavaPartitionerTest.
|
* Derived from JavaPartitionerTest.
|
||||||
*/
|
*/
|
||||||
public class CPartitionerTest extends TestCase {
|
public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
private CTextTools fTextTools;
|
private CTextTools fTextTools;
|
||||||
private Document fDocument;
|
private Document fDocument;
|
||||||
protected boolean fDocumentPartitioningChanged;
|
protected boolean fDocumentPartitioningChanged;
|
||||||
|
|
||||||
|
|
||||||
public CPartitionerTest(String name) {
|
public CPartitionerTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() {
|
protected void setUp() {
|
||||||
|
|
||||||
fTextTools= new CTextTools();
|
fTextTools= new CTextTools();
|
||||||
|
|
||||||
fDocument= new Document();
|
fDocument= new Document();
|
||||||
|
@ -84,7 +79,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkPartitioning(ITypedRegion[] expectation, ITypedRegion[] result) {
|
protected void checkPartitioning(ITypedRegion[] expectation, ITypedRegion[] result) {
|
||||||
|
|
||||||
assertEquals("invalid number of partitions", expectation.length, result.length);
|
assertEquals("invalid number of partitions", expectation.length, result.length);
|
||||||
|
|
||||||
for (int i= 0; i < expectation.length; i++) {
|
for (int i= 0; i < expectation.length; i++) {
|
||||||
|
@ -92,12 +86,10 @@ public class CPartitionerTest extends TestCase {
|
||||||
ITypedRegion r= result[i];
|
ITypedRegion r= result[i];
|
||||||
assertTrue(print(r) + " != " + print(e), r.equals(e));
|
assertTrue(print(r) + " != " + print(e), r.equals(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInitialPartitioning() {
|
public void testInitialPartitioning() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -121,7 +113,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testIntraPartitionChange() {
|
public void testIntraPartitionChange() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(34, 3, "y");
|
fDocument.replace(34, 3, "y");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\ny\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\ny\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -148,7 +139,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testIntraPartitionChange2() {
|
public void testIntraPartitionChange2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(41, 0, "yyy");
|
fDocument.replace(41, 0, "yyy");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/**yyy*/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/**yyy*/\nxxx");
|
||||||
|
|
||||||
|
@ -172,9 +162,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertNewPartition() {
|
public void testInsertNewPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(35, 1, "/***/");
|
fDocument.replace(35, 1, "/***/");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx/***/x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx/***/x\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -200,9 +190,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertStringPartition() {
|
public void testInsertStringPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(35, 1, "\"yyy\"");
|
fDocument.replace(35, 1, "\"yyy\"");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -228,9 +218,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertCharacterPartition() {
|
public void testInsertCharacterPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(35, 1, "'y'");
|
fDocument.replace(35, 1, "'y'");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -256,9 +246,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertPreprocessorPartition() {
|
public void testInsertPreprocessorPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(4, 0, " # include <x.h>\n");
|
fDocument.replace(4, 0, " # include <x.h>\n");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
// "xxx\n # include <x.h>\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n # include <x.h>\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
|
@ -287,13 +277,11 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRemovePartition1() {
|
public void testRemovePartition1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(13, 16, null);
|
fDocument.replace(13, 16, null);
|
||||||
// "xxx\n/*xxx*/\nx/**/\nxxx\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nx/**/\nxxx\n/***/\nxxx");
|
||||||
|
|
||||||
assertTrue(fDocumentPartitioningChanged);
|
assertTrue(fDocumentPartitioningChanged);
|
||||||
|
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
new TypedRegion(0, 4, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(0, 4, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
|
@ -312,12 +300,10 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemovePartition2() {
|
public void testRemovePartition2() {
|
||||||
|
|
||||||
testJoinPartition3();
|
testJoinPartition3();
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(5, 2, null);
|
fDocument.replace(5, 2, null);
|
||||||
// "xxx\nxxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\nxxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -340,10 +326,8 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testJoinPartitions1() {
|
public void testJoinPartitions1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(31, 1, null);
|
fDocument.replace(31, 1, null);
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -368,7 +352,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testJoinPartitions2() {
|
public void testJoinPartitions2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(32, 1, null);
|
fDocument.replace(32, 1, null);
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -393,7 +376,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testJoinPartition3() {
|
public void testJoinPartition3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(9, 2, null);
|
fDocument.replace(9, 2, null);
|
||||||
// "xxx\n/*xxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -416,22 +398,16 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testSplitPartition1() {
|
public void testSplitPartition1() {
|
||||||
|
|
||||||
testJoinPartitions1();
|
testJoinPartitions1();
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
||||||
fDocument.replace(31, 0, "*");
|
fDocument.replace(31, 0, "*");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
assertTrue(fDocumentPartitioningChanged);
|
assertTrue(fDocumentPartitioningChanged);
|
||||||
|
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -440,18 +416,15 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSplitPartition2() {
|
public void testSplitPartition2() {
|
||||||
|
|
||||||
testJoinPartitions2();
|
testJoinPartitions2();
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
||||||
fDocument.replace(32, 0, "/");
|
fDocument.replace(32, 0, "/");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
assertTrue(fDocumentPartitioningChanged);
|
assertTrue(fDocumentPartitioningChanged);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -460,11 +433,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSplitPartition3() {
|
public void testSplitPartition3() {
|
||||||
|
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
fDocument.replace(12, 9, "");
|
fDocument.replace(12, 9, "");
|
||||||
// "xxx\n/*xxx*/\nx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
@ -490,7 +461,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCorruptPartitioning1() {
|
public void testCorruptPartitioning1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/");
|
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -513,7 +483,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(14, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(14, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
new TypedRegion(15, 7, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(15, 7, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +490,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCorruptPartitioning2() {
|
public void testCorruptPartitioning2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/\n/***/");
|
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/\n/***/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -548,7 +516,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(22, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(22, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
new TypedRegion(23, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(23, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +523,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCorruptPartitioning3() {
|
public void testCorruptPartitioning3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/**/");
|
fDocument.replace(0, fDocument.getLength(), "/***/\n/**/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -581,7 +547,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(17, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(17, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
new TypedRegion(18, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(18, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -589,7 +554,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testOpenPartition1() {
|
public void testOpenPartition1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(42, 1, null);
|
fDocument.replace(42, 1, null);
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***\nxxx"
|
||||||
|
|
||||||
|
@ -616,7 +580,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testOpenPartition2() {
|
public void testOpenPartition2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(47, 0, "/*");
|
fDocument.replace(47, 0, "/*");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx/*"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx/*"
|
||||||
|
|
||||||
|
@ -646,7 +609,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testPartitionFinder() {
|
public void testPartitionFinder() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ITypedRegion[] partitioning= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] partitioning= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
|
||||||
for (int i= 0; i < partitioning.length; i++) {
|
for (int i= 0; i < partitioning.length; i++) {
|
||||||
|
@ -656,7 +618,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(expected.equals(result));
|
assertTrue(expected.equals(result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -664,7 +625,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testExtendPartition() {
|
public void testExtendPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/*");
|
fDocument.replace(0, fDocument.getLength(), "/*");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -681,7 +641,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -689,7 +648,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testTogglePartition() {
|
public void testTogglePartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "\t/*\n\tx\n\t/*/\n\ty\n//\t*/");
|
fDocument.replace(0, fDocument.getLength(), "\t/*\n\tx\n\t/*/\n\ty\n//\t*/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -712,7 +670,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(10, 12, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(10, 12, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation2, result);
|
checkPartitioning(expectation2, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -720,7 +677,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditing1() {
|
public void testEditing1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -749,7 +705,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -757,7 +712,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditing2() {
|
public void testEditing2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -794,7 +748,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -802,7 +755,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditing3() {
|
public void testEditing3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -831,7 +783,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(8, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
new TypedRegion(8, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -839,7 +790,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingString() {
|
public void testEditingString() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -904,7 +854,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(5, 2, ICPartitions.C_STRING)
|
new TypedRegion(5, 2, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -912,7 +861,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingCharacter() {
|
public void testEditingCharacter() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -977,7 +925,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(5, 2, ICPartitions.C_CHARACTER)
|
new TypedRegion(5, 2, ICPartitions.C_CHARACTER)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -985,7 +932,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingPreprocessor() {
|
public void testEditingPreprocessor() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -1096,7 +1042,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(33, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
new TypedRegion(33, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1049,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testLineSplicing_Bug124113() {
|
public void testLineSplicing_Bug124113() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "// comment... \\\\\ncontinued");
|
fDocument.replace(0, fDocument.getLength(), "// comment... \\\\\ncontinued");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -1136,7 +1080,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_CHARACTER)
|
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_CHARACTER)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1144,7 +1087,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCommentInPreprocessorString() {
|
public void testCommentInPreprocessorString() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "#define S \"http://www.foo.bar\"");
|
fDocument.replace(0, fDocument.getLength(), "#define S \"http://www.foo.bar\"");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -1160,7 +1102,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_PREPROCESSOR)
|
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_PREPROCESSOR)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1109,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testString1() {
|
public void testString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "\"[string]\"");
|
fDocument.replace(0, fDocument.getLength(), "\"[string]\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1184,7 +1124,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(10, 9, ICPartitions.C_STRING)
|
new TypedRegion(10, 9, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1192,7 +1131,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testString2() {
|
public void testString2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "\"string\"RRRRRRRR\"string\"nostring");
|
fDocument.replace(0, fDocument.getLength(), "\"string\"RRRRRRRR\"string\"nostring");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1202,7 +1140,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(24, 8, IDocument.DEFAULT_CONTENT_TYPE)
|
new TypedRegion(24, 8, IDocument.DEFAULT_CONTENT_TYPE)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1147,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString1() {
|
public void testRawString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "R\"(line 1\n/*line 2*/\nline 3\n)\"");
|
fDocument.replace(0, fDocument.getLength(), "R\"(line 1\n/*line 2*/\nline 3\n)\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1235,7 +1171,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(1, fDocument.getLength() - 1, ICPartitions.C_STRING)
|
new TypedRegion(1, fDocument.getLength() - 1, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1178,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString2() {
|
public void testRawString2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1261,7 +1195,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(13, fDocument.getLength() - 13, ICPartitions.C_STRING)
|
new TypedRegion(13, fDocument.getLength() - 13, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1269,7 +1202,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString3() {
|
public void testRawString3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1291,7 +1223,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1299,7 +1230,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString_Bug352544() {
|
public void testRawString_Bug352544() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
|
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1308,7 +1238,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1316,7 +1245,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingRawString1() {
|
public void testEditingRawString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1351,7 +1279,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1359,7 +1286,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingRawString2() {
|
public void testEditingRawString2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1402,7 +1328,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(6, fDocument.getLength() - 6, ICPartitions.C_STRING),
|
new TypedRegion(6, fDocument.getLength() - 6, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1335,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingRawString3() {
|
public void testEditingRawString3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1433,7 +1357,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Anton Leherbauer (Wind River Systems
|
* Anton Leherbauer (Wind River Systems
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.preferences;
|
package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
@ -81,7 +80,6 @@ import org.eclipse.cdt.internal.ui.text.util.CColorManager;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item in the highlighting color list.
|
* Item in the highlighting color list.
|
||||||
*/
|
*/
|
||||||
|
@ -161,7 +159,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SemanticHighlightingColorListItem extends HighlightingColorListItem {
|
private static class SemanticHighlightingColorListItem extends HighlightingColorListItem {
|
||||||
|
|
||||||
/** Enablement preference key */
|
/** Enablement preference key */
|
||||||
private final String fEnableKey;
|
private final String fEnableKey;
|
||||||
|
|
||||||
|
@ -175,7 +172,8 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
* @param underlineKey the underlineKey preference key
|
* @param underlineKey the underlineKey preference key
|
||||||
* @param enableKey the enable preference key
|
* @param enableKey the enable preference key
|
||||||
*/
|
*/
|
||||||
public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) {
|
public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey,
|
||||||
|
String italicKey, String strikethroughKey, String underlineKey, String enableKey) {
|
||||||
super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
|
super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
|
||||||
fEnableKey= enableKey;
|
fEnableKey= enableKey;
|
||||||
}
|
}
|
||||||
|
@ -192,9 +190,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
* Color list label provider.
|
* Color list label provider.
|
||||||
*/
|
*/
|
||||||
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
|
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof String)
|
if (element instanceof String)
|
||||||
|
@ -202,17 +197,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
return ((HighlightingColorListItem)element).getDisplayName();
|
return ((HighlightingColorListItem)element).getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getBackground(Object element) {
|
public Color getBackground(Object element) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getForeground(Object element) {
|
public Color getForeground(Object element) {
|
||||||
if (element instanceof SemanticHighlightingColorListItem) {
|
if (element instanceof SemanticHighlightingColorListItem) {
|
||||||
|
@ -228,25 +217,15 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
* Color list content provider.
|
* Color list content provider.
|
||||||
*/
|
*/
|
||||||
private class ColorListContentProvider implements ITreeContentProvider {
|
private class ColorListContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
|
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
}
|
}
|
||||||
|
@ -564,7 +543,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Control createSyntaxPage(final Composite parent) {
|
private Control createSyntaxPage(final Composite parent) {
|
||||||
|
|
||||||
Composite colorComposite= new Composite(parent, SWT.NONE);
|
Composite colorComposite= new Composite(parent, SWT.NONE);
|
||||||
GridLayout layout= new GridLayout();
|
GridLayout layout= new GridLayout();
|
||||||
layout.marginHeight= 0;
|
layout.marginHeight= 0;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.preferences;
|
package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -19,8 +18,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code coloring preference page.
|
* Code coloring preference page.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -30,41 +27,27 @@ import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class CEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage {
|
public class CEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHelpId() {
|
protected String getHelpId() {
|
||||||
return ICHelpContextIds.C_EDITOR_COLORS_PREF_PAGE;
|
return ICHelpContextIds.C_EDITOR_COLORS_PREF_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDescription() {
|
protected void setDescription() {
|
||||||
String description= PreferencesMessages.CEditorPreferencePage_colors;
|
String description= PreferencesMessages.CEditorPreferencePage_colors;
|
||||||
setDescription(description);
|
setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Label createDescriptionLabel(Composite parent) {
|
protected Label createDescriptionLabel(Composite parent) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setPreferenceStore() {
|
protected void setPreferenceStore() {
|
||||||
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
|
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
|
||||||
return new CEditorColoringConfigurationBlock(overlayPreferenceStore);
|
return new CEditorColoringConfigurationBlock(overlayPreferenceStore);
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class CPreprocessorScanner extends AbstractCScanner {
|
public class CPreprocessorScanner extends AbstractCScanner {
|
||||||
|
|
||||||
/** Properties for tokens. */
|
/** Properties for tokens. */
|
||||||
private static String[] fgTokenProperties= {
|
private static String[] fgTokenProperties= {
|
||||||
ICColorConstants.C_KEYWORD,
|
ICColorConstants.C_KEYWORD,
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.text;
|
package org.eclipse.cdt.internal.ui.text;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.rules.ICharacterScanner;
|
import org.eclipse.jface.text.rules.ICharacterScanner;
|
||||||
|
@ -24,13 +23,11 @@ import org.eclipse.jface.text.rules.Token;
|
||||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This scanner recognizes the C multi line comments, C single line comments,
|
* This scanner recognizes the C multi line comments, C single line comments,
|
||||||
* C strings, C characters and C preprocessor directives.
|
* C strings, C characters and C preprocessor directives.
|
||||||
*/
|
*/
|
||||||
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
|
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
|
||||||
|
|
||||||
// states
|
// states
|
||||||
private static final int CCODE= 0;
|
private static final int CCODE= 0;
|
||||||
private static final int SINGLE_LINE_COMMENT= 1;
|
private static final int SINGLE_LINE_COMMENT= 1;
|
||||||
|
@ -115,7 +112,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IToken nextToken() {
|
public IToken nextToken() {
|
||||||
|
|
||||||
fTokenOffset += fTokenLength;
|
fTokenOffset += fTokenLength;
|
||||||
fTokenLength= fPrefixLength;
|
fTokenLength= fPrefixLength;
|
||||||
|
|
||||||
|
@ -135,7 +131,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
fLast= NONE; // ignore last
|
fLast= NONE; // ignore last
|
||||||
if (fTokenLength > 0) {
|
if (fTokenLength > 0) {
|
||||||
return preFix(fState, CCODE, NONE, 0);
|
return preFix(fState, CCODE, NONE, 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fPrefixLength= 0;
|
fPrefixLength= 0;
|
||||||
return Token.EOF;
|
return Token.EOF;
|
||||||
|
@ -165,7 +160,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
|
|
||||||
fState= CCODE;
|
fState= CCODE;
|
||||||
return token;
|
return token;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
consume();
|
consume();
|
||||||
continue;
|
continue;
|
||||||
|
@ -220,7 +214,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
case STRING:
|
case STRING:
|
||||||
case PREPROCESSOR:
|
case PREPROCESSOR:
|
||||||
case PREPROCESSOR_STRING:
|
case PREPROCESSOR_STRING:
|
||||||
|
|
||||||
int last;
|
int last;
|
||||||
int newState;
|
int newState;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
@ -304,7 +297,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
fTokenLength= fPrefixLength;
|
fTokenLength= fPrefixLength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fTokenLength++;
|
fTokenLength++;
|
||||||
fLast= SLASH;
|
fLast= SLASH;
|
||||||
|
@ -321,7 +313,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
fTokenLength= fPrefixLength;
|
fTokenLength= fPrefixLength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
consume();
|
consume();
|
||||||
break;
|
break;
|
||||||
|
@ -603,7 +594,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
case BACKSLASH_CR:
|
case BACKSLASH_CR:
|
||||||
case BACKSLASH_BACKSLASH:
|
case BACKSLASH_BACKSLASH:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +614,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
return fTokens[interceptTokenState(state)];
|
return fTokens[interceptTokenState(state)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final IToken preFix(int state, int newState, int last, int prefixLength) {
|
private final IToken preFix(int state, int newState, int last, int prefixLength) {
|
||||||
fTokenLength -= getLastLength(fLast);
|
fTokenLength -= getLastLength(fLast);
|
||||||
fLast= last;
|
fLast= last;
|
||||||
|
@ -634,33 +623,25 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getState(String contentType) {
|
private static int getState(String contentType) {
|
||||||
|
if (contentType == null) {
|
||||||
if (contentType == null)
|
|
||||||
return CCODE;
|
return CCODE;
|
||||||
|
} else if (contentType.equals(C_SINGLE_LINE_COMMENT)) {
|
||||||
else if (contentType.equals(C_SINGLE_LINE_COMMENT))
|
|
||||||
return SINGLE_LINE_COMMENT;
|
return SINGLE_LINE_COMMENT;
|
||||||
|
} else if (contentType.equals(C_MULTI_LINE_COMMENT)) {
|
||||||
else if (contentType.equals(C_MULTI_LINE_COMMENT))
|
|
||||||
return MULTI_LINE_COMMENT;
|
return MULTI_LINE_COMMENT;
|
||||||
|
} else if (contentType.equals(C_STRING)) {
|
||||||
else if (contentType.equals(C_STRING))
|
|
||||||
return STRING;
|
return STRING;
|
||||||
|
} else if (contentType.equals(C_CHARACTER)) {
|
||||||
else if (contentType.equals(C_CHARACTER))
|
|
||||||
return CHARACTER;
|
return CHARACTER;
|
||||||
|
} else if (contentType.equals(C_PREPROCESSOR)) {
|
||||||
else if (contentType.equals(C_PREPROCESSOR))
|
|
||||||
return PREPROCESSOR;
|
return PREPROCESSOR;
|
||||||
|
} else if (contentType.equals(C_SINGLE_LINE_DOC_COMMENT)) {
|
||||||
else if (contentType.equals(C_SINGLE_LINE_DOC_COMMENT))
|
|
||||||
return SINGLE_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
return SINGLE_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
||||||
|
} else if (contentType.equals(C_MULTI_LINE_DOC_COMMENT)) {
|
||||||
else if (contentType.equals(C_MULTI_LINE_DOC_COMMENT))
|
|
||||||
return MULTI_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
return MULTI_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
||||||
|
} else {
|
||||||
else
|
|
||||||
return CCODE;
|
return CCODE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -705,9 +686,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ITokenScanner#setRange(IDocument, int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setRange(IDocument document, int offset, int length) {
|
public void setRange(IDocument document, int offset, int length) {
|
||||||
fDocument= document;
|
fDocument= document;
|
||||||
|
@ -743,15 +721,15 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
}
|
}
|
||||||
|
|
||||||
private int interceptTokenState(int proposedTokenState) {
|
private int interceptTokenState(int proposedTokenState) {
|
||||||
if(fOwner!=null) {
|
if (fOwner != null) {
|
||||||
switch(proposedTokenState) {
|
switch (proposedTokenState) {
|
||||||
case MULTI_LINE_COMMENT:
|
case MULTI_LINE_COMMENT:
|
||||||
if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
if (fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||||
return MULTI_LINE_DOC_COMMENT;
|
return MULTI_LINE_DOC_COMMENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SINGLE_LINE_COMMENT:
|
case SINGLE_LINE_COMMENT:
|
||||||
if(fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
if (fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||||
return SINGLE_LINE_DOC_COMMENT;
|
return SINGLE_LINE_DOC_COMMENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
||||||
* A slightly adapted FastPartitioner.
|
* A slightly adapted FastPartitioner.
|
||||||
*/
|
*/
|
||||||
public class FastCPartitioner extends FastPartitioner {
|
public class FastCPartitioner extends FastPartitioner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new partitioner for the given content types.
|
* Creates a new partitioner for the given content types.
|
||||||
*
|
*
|
||||||
|
@ -72,7 +71,7 @@ public class FastCPartitioner extends FastPartitioner {
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public IDocCommentOwner getDocCommentOwner() {
|
public IDocCommentOwner getDocCommentOwner() {
|
||||||
if(fScanner instanceof FastCPartitionScanner) {
|
if (fScanner instanceof FastCPartitionScanner) {
|
||||||
return ((FastCPartitionScanner)fScanner).getDocCommentOwner();
|
return ((FastCPartitionScanner)fScanner).getDocCommentOwner();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue