import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.Assert;
+//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;
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;
* 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;
* 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.
*/
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 == '<') {
// }
/**
- * 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();
* 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);
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);
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();
}
// 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();
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) {
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);
setDefaultReturnToken(getToken(IPreferenceConstants.PHP_DEFAULT));
return rules;
}
-}
\ No newline at end of file
+}