|
From: <caw...@us...> - 2007-07-23 15:29:13
|
Revision: 2817
http://svn.sourceforge.net/rubyeclipse/?rev=2817&view=rev
Author: cawilliams
Date: 2007-07-23 08:29:11 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
handle CGI.rb - multiple heredocs start on same line, but aren't separated by commas as when used as args in a method call. (concatenated together).
This doesn't properly color still, but at least it doesn't raise an exception that prevents the editor from opening like before.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-20 17:41:23 UTC (rev 2816)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-23 15:29:11 UTC (rev 2817)
@@ -161,7 +161,7 @@
return popTokenOffQueue();
} else if (lexerToken == Tokens.tSTRING_BEG) {
String opening = fContents.substring(fOffset - origOffset, lexerSource.getOffset());
- int index = opening.indexOf(",");
+ int index = indexOf(opening, ", +");
if (opening.trim().startsWith("<<") && index != -1) {
addHereDocStartToken(index);
addCommaToken(index);
@@ -203,6 +203,24 @@
return returnValue;
}
+ private int indexOf(String opening, String string) {
+ String trimmed = opening.trim();
+ int diff = opening.indexOf(trimmed.charAt(0)); // Count leading whitespace
+ int lowest = -1;
+ for (int i = 0; i < string.length(); i++) {
+ char c = string.charAt(i);
+ int value = trimmed.indexOf(c);
+ if (value == -1) continue;
+ value += diff;
+ if (lowest == -1) {
+ lowest = value;
+ continue;
+ }
+ if (value < lowest) lowest = value;
+ }
+ return lowest;
+ }
+
private void scanRestOfLine(String opening, int index) {
String possible = opening.substring(index + 1);
RubyPartitionScanner scanner = new RubyPartitionScanner();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|