Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2013-06-20 13:16:49 +0000
committerDani Megert2013-06-20 13:16:49 +0000
commite2a64527973722b66e2f1392f1ee360104d343a6 (patch)
tree94e7cb9e74f8b529b55e68e11c98dac5b9ed6d1b
parent7ea1061c223fdf21b84d633521628d8c7f4b0d71 (diff)
downloadeclipse.platform.text-e2a64527973722b66e2f1392f1ee360104d343a6.tar.gz
eclipse.platform.text-e2a64527973722b66e2f1392f1ee360104d343a6.tar.xz
eclipse.platform.text-e2a64527973722b66e2f1392f1ee360104d343a6.zip
Fixed bug 409538: org.eclipse.jface.text.rules.MultiLineRule EOF matching behavior changed
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java38
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java4
2 files changed, 39 insertions, 3 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
index f48bf80c12f..e0eca1be465 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -254,6 +254,42 @@ public class FastPartitionerTest extends TestCase {
}
+ public void testBug409538_1() throws Exception {
+ fPartitioner.disconnect();
+ IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
+ {
+ IToken comment= new Token(COMMENT);
+ IPredicateRule[] rules= new IPredicateRule[] { new MultiLineRule("<!--", "-->", comment, (char)0, true) };
+ setPredicateRules(rules);
+ }
+ };
+ fPartitioner= createPartitioner(scanner);
+ fDoc.setDocumentPartitioner(fPartitioner);
+ fPartitioner.connect(fDoc);
+
+ fDoc.set("<");
+ assertEqualPartition(0, 1, DEFAULT);
+
+ }
+
+ public void testBug409538_2() throws Exception {
+ fPartitioner.disconnect();
+ IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
+ {
+ IToken comment= new Token(COMMENT);
+ IPredicateRule[] rules= new IPredicateRule[] { new MultiLineRule("<!--", "-->", comment, (char)0, true) };
+ setPredicateRules(rules);
+ }
+ };
+ fPartitioner= createPartitioner(scanner);
+ fDoc.setDocumentPartitioner(fPartitioner);
+ fPartitioner.connect(fDoc);
+
+ fDoc.set("<!-- blah");
+ assertEqualPartition(0, 9, COMMENT);
+
+ }
+
private void assertComputePartitioning_InterleavingPartitions(int[] offsets) {
assertComputePartitioning_InterleavingPartitions(0, fDoc.getLength(), offsets, DEFAULT);
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java
index 209532e4bcf..d1d92f94496 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -191,7 +191,7 @@ public class PatternRule implements IPredicateRule {
int c= scanner.read();
if (c == fStartSequence[0]) {
- if (sequenceDetected(scanner, fStartSequence, fBreaksOnEOF)) {
+ if (sequenceDetected(scanner, fStartSequence, false)) {
if (endSequenceDetected(scanner))
return fToken;
}

Back to the top