Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-04-27 18:51:15 +0000
committerTom Schindl2016-04-27 18:51:15 +0000
commit2351d53fef3e10b12a8a5d8255fd440db83d73bb (patch)
tree1cb135ec6af0b5abd43a65aef5f207923300f8cf /bundles/code/org.eclipse.fx.text
parent406e3ac320cebd6ff05945c16c39d8419c696c0d (diff)
downloadorg.eclipse.efxclipse-2351d53fef3e10b12a8a5d8255fd440db83d73bb.tar.gz
org.eclipse.efxclipse-2351d53fef3e10b12a8a5d8255fd440db83d73bb.tar.xz
org.eclipse.efxclipse-2351d53fef3e10b12a8a5d8255fd440db83d73bb.zip
Bug 492592 - Rules need to be greedy to really work with the FastPartitioner
Diffstat (limited to 'bundles/code/org.eclipse.fx.text')
-rw-r--r--bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/CheckPointScanner.java4
-rw-r--r--bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/ExtendedPatternRule.java19
2 files changed, 21 insertions, 2 deletions
diff --git a/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/CheckPointScanner.java b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/CheckPointScanner.java
index 9516a6ed7..f0291f8fa 100644
--- a/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/CheckPointScanner.java
+++ b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/CheckPointScanner.java
@@ -34,7 +34,9 @@ public class CheckPointScanner implements ICharacterScanner {
@Override
public int read() {
this.charCount++;
- return this.realScanner.read();
+ int read = this.realScanner.read();
+ System.err.println("READ: '"+((char)read)+"'");
+ return read;
}
@Override
diff --git a/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/ExtendedPatternRule.java b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/ExtendedPatternRule.java
index ed3843f60..24f542dec 100644
--- a/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/ExtendedPatternRule.java
+++ b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/rules/ExtendedPatternRule.java
@@ -197,8 +197,21 @@ public class ExtendedPatternRule implements IPredicateRule {
int c= scanner.read();
if (c == fStartSequence[0]) {
if (sequenceStartDetected(scanner, fStartSequence, false)) {
- if (endSequenceDetected(scanner))
+ if (endSequenceDetected(scanner)) {
return fToken;
+ } else if(greedySuccess()) {
+ if( fBreaksOnEOL ) {
+ int cc;
+ do {
+ cc = scanner.read();
+ } while( cc != '\n' || cc != '\r' );
+ return fToken;
+ } else {
+ while (scanner.read() != ICharacterScanner.EOF) {
+ }
+ return fToken;
+ }
+ }
}
}
}
@@ -207,6 +220,10 @@ public class ExtendedPatternRule implements IPredicateRule {
return Token.UNDEFINED;
}
+ protected boolean greedySuccess() {
+ return true;
+ }
+
/*
* @see IRule#evaluate(ICharacterScanner)
*/

Back to the top