* Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material are made available under the
* terms of the Common Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors: www.phpeclipse.de
**********************************************************************************************************************************/
package net.sourceforge.phpdt.internal.compiler.parser;
/**
* ClassDeclaration Constructor.
- *
+ *
* @param s
* @param sess
* Description of Parameter
/**
* This method will throw the SyntaxError. It will add the good lines and
* columns to the Error
- *
+ *
* @param error
* the error message
* @throws SyntaxError
/**
* This method will throw the SyntaxError. It will add the good lines and
* columns to the Error
- *
+ *
* @param error
* the error message
* @throws SyntaxError
// | rw_variable T_INC
// | rw_variable T_DEC
case TokenNameIdentifier:
+ char[] ident = scanner.getCurrentTokenSource();
+ Expression lhsIdentifier = identifier(true, true);
+ if (lhsIdentifier != null) {
+ expression = lhsIdentifier;
+ }
+ if (token == TokenNameEQUAL || token == TokenNamePLUS_EQUAL
+ || token == TokenNameMINUS_EQUAL || token == TokenNameMULTIPLY_EQUAL || token == TokenNameDIVIDE_EQUAL
+ || token == TokenNameDOT_EQUAL || token == TokenNameREMAINDER_EQUAL || token == TokenNameAND_EQUAL
+ || token == TokenNameOR_EQUAL || token == TokenNameXOR_EQUAL || token == TokenNameRIGHT_SHIFT_EQUAL
+ || token == TokenNameLEFT_SHIFT_EQUAL) {
+ String error = "Assignment operator '"+scanner.toStringAction(token)+"' not allowed after identifier '"+new String(ident)+"' (use 'define(...)' to define constants).";
+ throwSyntaxError(error);
+ }
+ break;
case TokenNameVariable:
case TokenNameDOLLAR:
boolean rememberedVar = false;
}
}
+ private Expression identifier(boolean lefthandside, boolean ignoreVar) {
+ // variable:
+ // base_variable_with_function_calls T_OBJECT_OPERATOR
+ // object_property method_or_not variable_properties
+ // | base_variable_with_function_calls
+ return base_variable_with_function_calls(lefthandside, ignoreVar);
+ }
+
private void method_or_not() {
// method_or_not:
// '(' function_call_parameter_list ')'
/**
* Parse and check the include file name
- *
+ *
* @param includeToken
*/
private void checkFileName(int includeToken) {
// /* remember current scanner position */
// int startPos = scanner.startPosition;
// int currentPos = scanner.currentPosition;
- //
+ //
// this.checkAndReportBracketAnomalies(problemReporter());
// /* reset scanner where it was */
// scanner.startPosition = startPos;
"$_SESSION", "$_SERVER" };
/**
- *
+ *
*/
private void pushFunctionVariableSet() {
HashSet set = new HashSet();
/**
* add the current identifier source to the <i>set of assigned variables </i>
- *
+ *
* @param set
*/
private void addVariableSet(HashSet set) {
/**
* add the current identifier source to the <i>set of assigned variables </i>
- *
+ *
*/
private void addVariableSet() {
HashSet set = peekVariableSet();
/**
* add the current identifier source to the <i>set of assigned variables </i>
- *
+ *
*/
private void addVariableSet(char[] token) {
HashSet set = peekVariableSet();
* check if the current identifier source is in the <i>set of assigned
* variables </i> Returns true, if no set is defined for the current scanner
* position
- *
+ *
*/
private boolean containsVariableSet() {
return containsVariableSet(scanner.getCurrentTokenSource());