From: kpouer Date: Wed, 18 Jun 2003 22:02:57 +0000 (+0000) Subject: Added ` quoted strings and changed single quoted String into MultilineRule X-Git-Url: http://git.phpeclipse.com?hp=1e915f7490c160c0803c39622038433756d618fe Added ` quoted strings and changed single quoted String into MultilineRule --- 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 41cbee2..446c745 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,30 +16,14 @@ import java.util.List; import java.util.Vector; import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner; -import net.sourceforge.phpdt.internal.ui.text.JavaColorManager; import net.sourceforge.phpdt.ui.text.IColorManager; import net.sourceforge.phpdt.ui.text.IJavaColorConstants; -import net.sourceforge.phpeclipse.IPreferenceConstants; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr; import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector; import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.rules.EndOfLineRule; -import org.eclipse.jface.text.rules.ICharacterScanner; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.jface.text.rules.MultiLineRule; -import org.eclipse.jface.text.rules.SingleLineRule; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WhitespaceRule; -import org.eclipse.jface.text.rules.WordRule; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; +import org.eclipse.jface.text.rules.*; /** * PHP Code Scanner @@ -261,13 +245,19 @@ public class PHPCodeScanner Token token= getToken(IJavaColorConstants.PHP_SINGLE_LINE_COMMENT); // Add rule for single line comments. rules.add(new EndOfLineRule("//", token)); //$NON-NLS-1$ - rules.add(new EndOfLineRule("#", token)); + rules.add(new EndOfLineRule("#", token)); //$NON-NLS-1$ // Add rule for strings and character constants. token= getToken(IJavaColorConstants.PHP_STRING); rules.add(new MultiLineRule("\"", "\"", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ - rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ + rules.add(new MultiLineRule("`", "`", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ + rules.add(new MultiLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ + + //previous version + //rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ + + token= getToken(IJavaColorConstants.PHP_MULTI_LINE_COMMENT); - rules.add(new MultiLineRule("/*", "*/", token)); + rules.add(new MultiLineRule("/*", "*/", token)); //$NON-NLS-2$ //$NON-NLS-1$ // Add generic whitespace rule. rules.add(new WhitespaceRule(new PHPWhitespaceDetector())); // Add word rule for keywords, types, and constants. @@ -280,7 +270,7 @@ public class PHPCodeScanner Token constant= getToken(IJavaColorConstants.PHP_CONSTANT); PHPSyntaxRdr.readInSyntax(); Vector buffer = PHPSyntaxRdr.getsyntaxdata(); - String strbuffer = null; + // String strbuffer = null; unused PHPElement elbuffer = null; while ((buffer != null) && (!buffer.isEmpty() @@ -295,7 +285,7 @@ public class PHPCodeScanner wordRule.addWord(elbuffer.getName(), constant); } rules.add(wordRule); - IRule[] result = new IRule[rules.size()]; + // IRule[] result = new IRule[rules.size()];unused // rules.toArray(result); // setRules(result); return rules;