Removed unuse builder from project
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / php / PHPCodeScanner.java
index 042eb5b..410e0c1 100644 (file)
@@ -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;
@@ -26,7 +25,6 @@ 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;
 import org.eclipse.jface.text.rules.ICharacterScanner;
 import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
@@ -43,14 +41,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 +62,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 +77,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 <code>true</code> iff the character is an operator,
                 *         <code>false</code> otherwise.
                 */
@@ -103,7 +103,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 +188,16 @@ public class PHPCodeScanner extends AbstractJavaScanner {
                // }
 
                /**
-                * Check if lastCharacter/character are a PHP start or end token ( &lt;? ...
-                * ?&gt; )
-                *
+                * Check if lastCharacter/character are a PHP start or end token ( &lt;?
+                * ... ?&gt; )
+                * 
                 * @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 +263,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 <code>null</code>
+                *            the word this rule will search for, may not be
+                *            <code>null</code>
                 * @param token
-                *          the token to be returned if the word has been found, may not be
-                *          <code>null</code>
+                *            the token to be returned if the word has been found, may
+                *            not be <code>null</code>
                 */
                public void addWordIgnoreCase(String word, IToken token) {
                        Assert.isNotNull(word);
@@ -327,7 +330,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 +339,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 +375,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 +451,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 +465,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);