X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java
index 042eb5b..8f2eed7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java
@@ -16,7 +16,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
import net.sourceforge.phpdt.ui.text.IColorManager;
import net.sourceforge.phpeclipse.IPreferenceConstants;
@@ -25,8 +24,9 @@ import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector;
import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
+//incastrix
+//import org.eclipse.jface.text.Assert;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
@@ -43,14 +43,15 @@ public class PHPCodeScanner extends AbstractJavaScanner {
/**
* Rule to detect java operators.
- *
+ *
* @since 3.0
*/
protected class OperatorRule implements IRule {
/** Java operators */
- private final char[] PHP_OPERATORS = { ';', '(', ')', '.', '=', '/', '\\', '+', '-', '*', '[', ']', '<', '>', ':', '?', '!',
- ',', '|', '&', '^', '%', '~', '@' };
+ private final char[] PHP_OPERATORS = { ';', '(', ')', '.', '=', '/',
+ '\\', '+', '-', '*', '[', ']', '<', '>', ':', '?', '!', ',',
+ '|', '&', '^', '%', '~', '@' };
/** Token to return for this rule */
private final IToken fToken;
@@ -63,13 +64,14 @@ public class PHPCodeScanner extends AbstractJavaScanner {
/**
* Creates a new operator rule.
- *
+ *
* @param token
- * Token to use for this rule
+ * Token to use for this rule
* @param tokenHeredoc
- * TODO
+ * TODO
*/
- public OperatorRule(IToken token, IToken tokenBraces, IToken tokenHeredoc) {
+ public OperatorRule(IToken token, IToken tokenBraces,
+ IToken tokenHeredoc) {
fToken = token;
fTokenBraces = tokenBraces;
fTokenHeredoc = tokenHeredoc;
@@ -77,9 +79,9 @@ public class PHPCodeScanner extends AbstractJavaScanner {
/**
* Is this character an operator character?
- *
+ *
* @param character
- * Character to determine whether it is an operator character
+ * Character to determine whether it is an operator character
* @return true
iff the character is an operator,
* false
otherwise.
*/
@@ -103,7 +105,8 @@ public class PHPCodeScanner extends AbstractJavaScanner {
if (isOperator((char) character)) {
int lastCharacter = character;
character = scanner.read();
- // the readHEREDOC(scanner) call doesn't work, if we have our own partitions for single quoted
+ // the readHEREDOC(scanner) call doesn't work, if we have our
+ // own partitions for single quoted
// or double quoted strings:
//
// if (lastCharacter == '<' && character == '<') {
@@ -187,15 +190,16 @@ public class PHPCodeScanner extends AbstractJavaScanner {
// }
/**
- * Check if lastCharacter/character are a PHP start or end token ( <? ...
- * ?> )
- *
+ * Check if lastCharacter/character are a PHP start or end token ( <?
+ * ... ?> )
+ *
* @param scanner
* @param lastCharacter
* @param character
* @return
*/
- private boolean checkPHPTag(ICharacterScanner scanner, int lastCharacter, int character) {
+ private boolean checkPHPTag(ICharacterScanner scanner,
+ int lastCharacter, int character) {
if (lastCharacter == '<' && character == '?') {
scanner.unread();
scanner.unread();
@@ -261,12 +265,13 @@ public class PHPCodeScanner extends AbstractJavaScanner {
/**
* Adds a word and the token to be returned if it is detected.
- *
+ *
* @param word
- * the word this rule will search for, may not be null
+ * the word this rule will search for, may not be
+ * null
* @param token
- * the token to be returned if the word has been found, may not be
- * null
+ * the token to be returned if the word has been found, may
+ * not be null
*/
public void addWordIgnoreCase(String word, IToken token) {
Assert.isNotNull(word);
@@ -327,7 +332,8 @@ public class PHPCodeScanner extends AbstractJavaScanner {
if (c == '$') {
isVariable = true;
}
- if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
+ if (fColumn == UNDEFINED
+ || (fColumn == scanner.getColumn() - 1)) {
fBuffer.setLength(0);
fBuffer.append((char) c);
@@ -335,7 +341,8 @@ public class PHPCodeScanner extends AbstractJavaScanner {
if (c == '_') {
isUnderscore = true;
}
- while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)) {
+ while (c != ICharacterScanner.EOF
+ && fDetector.isWordPart((char) c)) {
fBuffer.append((char) c);
c = scanner.read();
}
@@ -370,17 +377,26 @@ public class PHPCodeScanner extends AbstractJavaScanner {
// private PHPColorProvider fColorProvider;
- private static String[] fgTokenProperties = { IPreferenceConstants.PHP_MULTILINE_COMMENT,
- IPreferenceConstants.PHP_SINGLELINE_COMMENT, IPreferenceConstants.PHP_TAG, IPreferenceConstants.PHP_KEYWORD,
- IPreferenceConstants.PHP_FUNCTIONNAME, IPreferenceConstants.PHP_VARIABLE, IPreferenceConstants.PHP_VARIABLE_DOLLAR,
- IPreferenceConstants.PHP_STRING_DQ, IPreferenceConstants.PHP_STRING_SQ, IPreferenceConstants.PHP_TYPE,
- IPreferenceConstants.PHP_CONSTANT, IPreferenceConstants.PHP_DEFAULT, IPreferenceConstants.PHP_OPERATOR,
- IPreferenceConstants.PHP_BRACE_OPERATOR, IPreferenceConstants.PHP_KEYWORD_RETURN };
+ private static String[] fgTokenProperties = {
+ IPreferenceConstants.PHP_MULTILINE_COMMENT,
+ IPreferenceConstants.PHP_SINGLELINE_COMMENT,
+ IPreferenceConstants.PHP_TAG, IPreferenceConstants.PHP_KEYWORD,
+ IPreferenceConstants.PHP_FUNCTIONNAME,
+ IPreferenceConstants.PHP_VARIABLE,
+ IPreferenceConstants.PHP_VARIABLE_DOLLAR,
+ IPreferenceConstants.PHP_STRING_DQ,
+ IPreferenceConstants.PHP_STRING_SQ, IPreferenceConstants.PHP_TYPE,
+ IPreferenceConstants.PHP_CONSTANT,
+ IPreferenceConstants.PHP_DEFAULT,
+ IPreferenceConstants.PHP_OPERATOR,
+ IPreferenceConstants.PHP_BRACE_OPERATOR,
+ IPreferenceConstants.PHP_KEYWORD_RETURN };
/**
* Creates a PHP code scanner
*/
- // public PHPCodeScanner(JavaColorManager provider, IPreferenceStore store) {
+ // public PHPCodeScanner(JavaColorManager provider, IPreferenceStore store)
+ // {
public PHPCodeScanner(IColorManager manager, IPreferenceStore store) {
super(manager, store);
initialize();
@@ -437,7 +453,8 @@ public class PHPCodeScanner extends AbstractJavaScanner {
wordRule.addWord(name, keyword);
}
} else if (elbuffer instanceof PHPFunction) {
- wordRule.addWordIgnoreCase(((PHPFunction) elbuffer).getName(), functionName);
+ wordRule.addWordIgnoreCase(((PHPFunction) elbuffer).getName(),
+ functionName);
} else if (elbuffer instanceof PHPType) {
wordRule.addWord(elbuffer.getName(), type);
} else if (elbuffer instanceof PHPConstant) {
@@ -450,7 +467,8 @@ public class PHPCodeScanner extends AbstractJavaScanner {
wordRule.addWord("return", token);
// Add rule for operators and brackets (at the end !)
- rules.add(new OperatorRule(getToken(IPreferenceConstants.PHP_OPERATOR), getToken(IPreferenceConstants.PHP_BRACE_OPERATOR),
+ rules.add(new OperatorRule(getToken(IPreferenceConstants.PHP_OPERATOR),
+ getToken(IPreferenceConstants.PHP_BRACE_OPERATOR),
getToken(IPreferenceConstants.PHP_STRING_DQ)));
rules.add(wordRule);