1) Fixed issue #844: Short form of ternary operator (since PHP 5.3).
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / Parser.java
index 98c996d..121754c 100644 (file)
@@ -3059,13 +3059,13 @@ public class Parser implements ITerminalSymbols, CompilerModifiers,
                                                        if (rememberedVar == false && lhs != null
                                                                        && lhs instanceof FieldReference) {
                                                                if (fMethodVariables != null) {
-                                                                       VariableInfo lhsInfo = new VariableInfo(
-                                                                                       ((FieldReference) lhs).sourceStart);
-                                                                       fMethodVariables.put(new String(
-                                                                                       ((FieldReference) lhs).token), lhsInfo);
+                                                                       VariableInfo lhsInfo = new VariableInfo (((FieldReference) lhs).sourceStart);
+                                                                       fMethodVariables.put (new String (((FieldReference) lhs).token), lhsInfo);
                                                                }
                                                        }
                                                        break;
+                                                       
+                                               case TERNARY_SHORT:
                                                case PLUS_EQUAL:
                                                case MINUS_EQUAL:
                                                case MULTIPLY_EQUAL:
@@ -3270,6 +3270,12 @@ public class Parser implements ITerminalSymbols, CompilerModifiers,
                                                        expression.sourceEnd = scanner.getCurrentTokenEndPosition();
                                                }
                                                break;
+
+                                       case TERNARY_SHORT:
+                                               getNextToken();
+                                               expression = new EqualExpression(expression, expr_without_variable (only_variable, initHandler, bColonAllowed), OperatorIds.TERNARY_SHORT);
+                                               break;
+                                               
                                        case QUESTION:
                                                getNextToken();
                                                Expression valueIfTrue = expr_without_variable (true, null, true);
@@ -3279,8 +3285,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers,
                                                getNextToken();
                                                Expression valueIfFalse = expr();
 
-                                               expression = new ConditionalExpression(expression,
-                                                               valueIfTrue, valueIfFalse);
+                                               expression = new ConditionalExpression (expression, valueIfTrue, valueIfFalse);
                                                break;
                                        default:
                                                return expression;