this is a test commit to check the integration of cia.navi.cx
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ui / text / PHPStringDQCodeScanner.java
index 943f0df..df0bf72 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.jface.text.rules.WordRule;
  */
 public final class PHPStringDQCodeScanner extends AbstractJavaScanner {
 
-  private static String[] fgTokenProperties = { IPreferenceConstants.PHP_STRING_DQ, IPreferenceConstants.PHP_VARIABLE };
+  private static String[] fgTokenProperties = { IPreferenceConstants.PHP_STRING_DQ, IPreferenceConstants.PHP_VARIABLE, IPreferenceConstants.PHP_VARIABLE_DOLLAR};
 
   private class PHPWordRule extends WordRule {
     private StringBuffer fBuffer = new StringBuffer();
@@ -45,17 +45,24 @@ public final class PHPStringDQCodeScanner extends AbstractJavaScanner {
 
     public IToken evaluate(ICharacterScanner scanner) {
       int c = scanner.read();
-
+      boolean isUnderscore = false;
       if (fDetector.isWordStart((char) c)) {
         if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
 
           fBuffer.setLength(0);
-          do {
+          fBuffer.append((char) c);
+          c = scanner.read();
+          if (c=='_') {
+               isUnderscore = true;
+          }
+          while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)) {
             fBuffer.append((char) c);
             c = scanner.read();
-          } while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c));
+          } 
           scanner.unread();
-
+          if (isUnderscore) {
+               return getToken(IPreferenceConstants.PHP_VARIABLE_DOLLAR);
+          }
           return getToken(IPreferenceConstants.PHP_VARIABLE);
         }
       }