*/
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();
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);
}
}