diff options
author | Dani Megert | 2013-06-20 13:16:49 +0000 |
---|---|---|
committer | Markus Keller | 2013-07-30 19:03:49 +0000 |
commit | 5f61625d0cbdede52214766d19cc702e6432e35b (patch) | |
tree | 85c70278ee1aa65cf1dd64c05c5d273c295e6120 | |
parent | 42b8f057f38f1ba37c637d7009ec85bc05039e2d (diff) | |
download | eclipse.platform.text-5f61625d0cbdede52214766d19cc702e6432e35b.tar.gz eclipse.platform.text-5f61625d0cbdede52214766d19cc702e6432e35b.tar.xz eclipse.platform.text-5f61625d0cbdede52214766d19cc702e6432e35b.zip |
Fixed bug 409538: org.eclipse.jface.text.rules.MultiLineRule EOF matching behavior changedM20130731-0800
-rw-r--r-- | org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java | 38 | ||||
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java | 4 |
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; } |