import net.sourceforge.phpdt.core.compiler.*;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.phpeditor.PHPString;
-import net.sourceforge.phpeclipse.phpeditor.php.PHPKeywords;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.ui.texteditor.MarkerUtilities;
import test.PHPParserSuperclass;
-public class Parser
- extends PHPParserSuperclass
- implements PHPKeywords, ITerminalSymbols {
+public class Parser extends PHPParserSuperclass implements ITerminalSymbols {
- public static final int ERROR = 2;
- public static final int WARNING = 1;
- public static final int INFO = 0;
-
- //scanner token
+ //scanner token
public Scanner scanner;
private IFile fileToParse;
setMarker(fileToParse, message, charStart, charEnd, errorLevel);
}
- public static void setMarker(
- IFile file,
- String message,
- int charStart,
- int charEnd,
- int errorLevel)
- throws CoreException {
- if (file != null) {
- Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR :
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING :
- attributes.put(
- IMarker.SEVERITY,
- new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO :
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- }
- MarkerUtilities.setCharStart(attributes, charStart);
- MarkerUtilities.setCharEnd(attributes, charEnd);
- // setLineNumber(attributes, lineNumber);
- MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
- }
- }
-
/**
* This method will throw the SyntaxError.
* It will add the good lines and columns to the Error
unaryExpression();
}
- private void typeName() throws CoreException {
- //'string' 'unset' 'array' 'object'
- //'bool' 'boolean'
- //'real' 'double' 'float'
- //'int' 'integer'
- String identifier = "";
- if (token == TokenNameIdentifier) {
- char[] ident = scanner.getCurrentIdentifierSource();
- identifier = new String(ident);
- String str = identifier.toLowerCase();
- getNextToken();
- for (int i = 0; i < PHP_TYPES.length; i++) {
- if (PHP_TYPES[i].equals(str)) {
- return;
- }
- }
- }
- throwSyntaxError(
- "Expected type cast '( <type-name> )'; Got '" + identifier + "'.");
- }
+ // private void typeName() throws CoreException {
+ // //'string' 'unset' 'array' 'object'
+ // //'bool' 'boolean'
+ // //'real' 'double' 'float'
+ // //'int' 'integer'
+ // String identifier = "";
+ // if (token == TokenNameIdentifier) {
+ // char[] ident = scanner.getCurrentIdentifierSource();
+ // identifier = new String(ident);
+ // String str = identifier.toLowerCase();
+ // getNextToken();
+ // for (int i = 0; i < PHP_TYPES.length; i++) {
+ // if (PHP_TYPES[i].equals(str)) {
+ // return;
+ // }
+ // }
+ // }
+ // throwSyntaxError(
+ // "Expected type cast '( <type-name> )'; Got '" + identifier + "'.");
+ // }
private void assignExpression() throws CoreException {
castExpression();