From d4161054e56bdb06af7c54ee11be5f04e237a3a0 Mon Sep 17 00:00:00 2001 From: kpouer Date: Wed, 18 Jun 2003 22:02:57 +0000 Subject: [PATCH] Added ` quoted strings and changed single quoted String into MultilineRule --- .../phpeclipse/phpeditor/php/PHPCodeScanner.java | 34 +++++++------------- 1 files changed, 12 insertions(+), 22 deletions(-) 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; -- 1.7.1