Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorggurfinke2008-07-06 01:59:18 -0400
committerggurfinke2008-07-06 01:59:18 -0400
commitbbd8a755651dcdcd820d5a9bb97ac9994cf22ffb (patch)
tree7826b155f057d9ae5cceb6929f063e5f4c56b71f
parent8968f62bdca23dbbfc28a612bce8ba4e6efe4cfa (diff)
downloadorg.eclipse.pdt-20080716.tar.gz
org.eclipse.pdt-20080716.tar.xz
org.eclipse.pdt-20080716.zip
short term solution for bug 239705v20080716
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php5/completion_scanner.flex48
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/phpModel/parser/php5/CompletionLexer5.java51
2 files changed, 56 insertions, 43 deletions
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php5/completion_scanner.flex b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php5/completion_scanner.flex
index 74e5a449a..300fccdb4 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php5/completion_scanner.flex
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php5/completion_scanner.flex
@@ -13,6 +13,8 @@ package org.eclipse.php.internal.core.phpModel.parser.php5;
import java_cup.runtime.Symbol;
import java_cup.sym;
+
+import org.eclipse.php.internal.core.Logger;
import org.eclipse.php.internal.core.util.collections.IntHashtable;
import org.eclipse.php.internal.core.phpModel.parser.CompletionLexer;
import org.eclipse.php.internal.core.phpModel.parser.ParserClient;
@@ -343,28 +345,32 @@ import java.util.regex.Pattern;
}
public String createString(int startOffset, int endOffset) {
- int startPosition = startOffset + yy_pushbackPos;
- int length = endOffset - startOffset;
- if(startPosition < 0){
- startPosition = startOffset + yy_old_pushbackPos;
- if(startPosition + length < yy_old_buffer.length){
- if(startPosition < 0 || startPosition + length > yy_old_buffer.length){
- return "";
- }
- return new String(yy_old_buffer, startPosition, length);
- }
- // meaning the string was splited between the two buffers
- int remainder = startPosition + length + duplicated_string_length - yy_old_buffer.length;
- length -= remainder;
- if(startPosition < 0 || startPosition + length > yy_old_buffer.length || remainder > yy_buffer.length){
- return "";
- }
- return (new String(yy_old_buffer, startPosition, length) + new String(yy_buffer, 0, remainder));
- }
- if(startPosition < 0 || startPosition + length > yy_buffer.length){
- return "";
+ try{
+ int startPosition = startOffset + yy_pushbackPos;
+ int length = endOffset - startOffset;
+ if(startPosition < 0){
+ startPosition = startOffset + yy_old_pushbackPos;
+ if(startPosition + length < yy_old_buffer.length){
+ if(startPosition < 0 || startPosition + length > yy_old_buffer.length){
+ return "";
+ }
+ return new String(yy_old_buffer, startPosition, length);
+ }
+ // meaning the string was splited between the two buffers
+ int remainder = startPosition + length + duplicated_string_length - yy_old_buffer.length;
+ length -= remainder;
+ if(startPosition < 0 || startPosition + length > yy_old_buffer.length || remainder > yy_buffer.length){
+ return "";
+ }
+ return (new String(yy_old_buffer, startPosition, length) + new String(yy_buffer, 0, remainder));
+ }
+ if(startPosition < 0 || startPosition + length > yy_buffer.length){
+ return "";
+ }
+ return new String(yy_buffer, startPosition, length);
+ } catch (Exception e) { //short term solution for bug 239705
+ Logger.logException(e);
}
- return new String(yy_buffer, startPosition, length);
}
%}
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/phpModel/parser/php5/CompletionLexer5.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/phpModel/parser/php5/CompletionLexer5.java
index 982a01404..4a839a1cf 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/phpModel/parser/php5/CompletionLexer5.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/phpModel/parser/php5/CompletionLexer5.java
@@ -15,6 +15,8 @@ package org.eclipse.php.internal.core.phpModel.parser.php5;
import java_cup.runtime.Symbol;
import java_cup.sym;
+
+import org.eclipse.php.internal.core.Logger;
import org.eclipse.php.internal.core.util.collections.IntHashtable;
import org.eclipse.php.internal.core.phpModel.parser.CompletionLexer;
import org.eclipse.php.internal.core.phpModel.parser.ParserClient;
@@ -1275,28 +1277,33 @@ public class CompletionLexer5 extends CompletionLexer implements java_cup.runtim
}
public String createString(int startOffset, int endOffset) {
- int startPosition = startOffset + yy_pushbackPos;
- int length = endOffset - startOffset;
- if(startPosition < 0){
- startPosition = startOffset + yy_old_pushbackPos;
- if(startPosition + length < yy_old_buffer.length){
- if(startPosition < 0 || startPosition + length > yy_old_buffer.length){
- return "";
- }
- return new String(yy_old_buffer, startPosition, length);
- }
- // meaning the string was splited between the two buffers
- int remainder = startPosition + length + duplicated_string_length - yy_old_buffer.length;
- length -= remainder;
- if(startPosition < 0 || startPosition + length > yy_old_buffer.length || remainder > yy_buffer.length){
- return "";
- }
- return (new String(yy_old_buffer, startPosition, length) + new String(yy_buffer, 0, remainder));
- }
- if(startPosition < 0 || startPosition + length > yy_buffer.length){
- return "";
- }
- return new String(yy_buffer, startPosition, length);
+ try{
+ int startPosition = startOffset + yy_pushbackPos;
+ int length = endOffset - startOffset;
+ if(startPosition < 0){
+ startPosition = startOffset + yy_old_pushbackPos;
+ if(startPosition + length < yy_old_buffer.length){
+ if(startPosition < 0 || startPosition + length > yy_old_buffer.length){
+ return "";
+ }
+ return new String(yy_old_buffer, startPosition, length);
+ }
+ // meaning the string was splited between the two buffers
+ int remainder = startPosition + length + duplicated_string_length - yy_old_buffer.length;
+ length -= remainder;
+ if(startPosition < 0 || startPosition + length > yy_old_buffer.length || remainder > yy_buffer.length){
+ return "";
+ }
+ return (new String(yy_old_buffer, startPosition, length) + new String(yy_buffer, 0, remainder));
+ }
+ if(startPosition < 0 || startPosition + length > yy_buffer.length){
+ return "";
+ }
+ return new String(yy_buffer, startPosition, length);
+ }catch (Exception e){
+ Logger.logException(e);
+ }
+ return "";
}

Back to the top