* expression.cs (Binary.Operator): Added Exponentiation,
authorJambunathan K <jambunathan@mono-cvs.ximian.com>
Sat, 26 Mar 2005 08:43:08 +0000 (08:43 -0000)
committerJambunathan K <jambunathan@mono-cvs.ximian.com>
Sat, 26 Mar 2005 08:43:08 +0000 (08:43 -0000)
Concatenation, Like, Is and IntegerDivision opeartors

* mb-parser.jay: Changes relating to the above changes.

svn path=/trunk/mcs/; revision=42264

mcs/bmcs/ChangeLog
mcs/bmcs/expression.cs
mcs/bmcs/mb-parser.jay

index 9824dcf11ad91fdfc47cfc7f118badf6263fa397..73e743a8e41d0daf1b4c37346ac807b9a7f4130c 100644 (file)
@@ -1,3 +1,10 @@
+2005-03-26  Jambunathan K  <kjambunathan.devel@gmail.com>
+
+       * expression.cs (Binary.Operator): Added Exponentiation,
+       Concatenation, Like, Is and IntegerDivision opeartors
+
+       * mb-parser.jay: Changes relating to the above changes.
+
 2005-03-26  Jambunathan K  <kjambunathan.devel@gmail.com>
 
        * expression.cs (Binary.Operator): Renamed LogicalAnd/LogicalOr to
index ef99bde1785382b062e52c5211d01e61ab28e06a..264f6fe4342deba9486fb9e9ea3929a44f8d6354 100644 (file)
@@ -1854,16 +1854,17 @@ namespace Mono.CSharp {
        /// </summary>
        public class Binary : Expression {
                public enum Operator : byte {
-                       Multiply, Division, Modulus,
+                       Exponentiation,
+                       Multiply, Division, 
+                       IntegerDivision, 
+                       Modulus,
                        Addition, Subtraction,
+                       Concatenation,
                        LeftShift, RightShift,
-                       LessThan, GreaterThan, LessThanOrEqual, GreaterThanOrEqual
-                       Equality, Inequality,
-                       BitwiseAnd,
+                               Equality, Inequality, LessThan, GreaterThan, LessThanOrEqual, GreaterThanOrEqual, Like, Is
+                       BitwiseAnd, LogicalAndAlso,
+                       BitwiseOr, LogicalOrElse,
                        ExclusiveOr,
-                       BitwiseOr,
-                       LogicalAndAlso,
-                       LogicalOrElse,
                        TOP
                }
 
index 4f85e7c11c2419930c5cc5e267ac3b5af87e1998..fd5d941f97751bba90e158e4670adcdc8dff5568 100644 (file)
@@ -4490,8 +4490,7 @@ integer_division_expression
        : multiplicative_expression
        | integer_division_expression OP_IDIV multiplicative_expression
           {
-               //FIXME: Is this right ?
-               $$ = new Binary (Binary.Operator.Division,
+             $$ = new Binary (Binary.Operator.IntegerDivision,
                           (Expression) $1, (Expression) $3, lexer.Location);
           }
        ;
@@ -4509,13 +4508,13 @@ additive_expression
        : mod_expression
        | additive_expression PLUS mod_expression
          {
-               $$ = new Binary (Binary.Operator.Addition,
-                                (Expression) $1, (Expression) $3, lexer.Location);
+             $$ = new Binary (Binary.Operator.Addition,
+                              (Expression) $1, (Expression) $3, lexer.Location);
          }
        | additive_expression MINUS mod_expression
          {
-               $$ = new Binary (Binary.Operator.Subtraction,
-                                (Expression) $1, (Expression) $3, lexer.Location);
+             $$ = new Binary (Binary.Operator.Subtraction,
+                              (Expression) $1, (Expression) $3, lexer.Location);
          }
        ;
 
@@ -4523,9 +4522,7 @@ concat_expression
        : additive_expression
        | concat_expression OP_CONCAT additive_expression
           {
-             // FIXME: This should only work for String expressions
-             // We probably need to use something from the runtime
-             $$ = new Binary (Binary.Operator.Addition,
+             $$ = new Binary (Binary.Operator.Concatenation,
                               (Expression) $1, (Expression) $3, lexer.Location);
          }     
        ;
@@ -4534,11 +4531,13 @@ shift_expression
        : concat_expression
        | shift_expression OP_SHIFT_LEFT concat_expression
          {
-               // TODO
+              $$ = new Binary (Binary.Operator.LeftShift, 
+                               (Expression) $1, (Expression) $3, lexer.Location);
          }
        | shift_expression OP_SHIFT_RIGHT concat_expression
          {
-               //TODO
+              $$ = new Binary (Binary.Operator.RightShift, 
+                               (Expression) $1, (Expression) $3, lexer.Location);
          }
        ;
 
@@ -4576,14 +4575,12 @@ relational_expression
          }
        | relational_expression IS shift_expression
          {
-               //FIXME: Should be a different op for reference equality but allows tests to use Is
-               $$ = new Binary (Binary.Operator.Equality,
+               $$ = new Binary (Binary.Operator.Is,
                                 (Expression) $1, (Expression) $3, lexer.Location);
          }
        | TYPEOF shift_expression IS type
          {
-               //FIXME: Is this rule correctly defined ?
-               $$ = new Is ((Expression) $2, (Expression) $4, lexer.Location);
+                $$ = new Is ((Expression) $2, (Expression) $4, lexer.Location);
          }
        ;
 
@@ -4591,8 +4588,7 @@ negation_expression
        : relational_expression
        | NOT negation_expression 
          {
-               //FIXME: Is this rule correctly defined ?
-               $$ = new Unary (Unary.Operator.LogicalNot, (Expression) $2, lexer.Location);
+               $$ = new Unary (Unary.Operator.OnesComplement, (Expression) $2, lexer.Location);
          }
        ;
        
@@ -4600,11 +4596,11 @@ conditional_and_expression
        : negation_expression
        | conditional_and_expression AND negation_expression
          {
-//             $$ = new Binary (Binary.Operator.LogicalAnd,
-//                              (Expression) $1, (Expression) $3, lexer.Location);
+               $$ = new Binary (Binary.Operator.BitwiseAnd,
+                                (Expression) $1, (Expression) $3, lexer.Location);
          }
        | conditional_and_expression ANDALSO negation_expression
-         {     // FIXME: this is likely to be broken
+         {     
                $$ = new Binary (Binary.Operator.LogicalAndAlso,
                                 (Expression) $1, (Expression) $3, lexer.Location);
          }
@@ -4614,11 +4610,11 @@ conditional_or_expression
        : conditional_and_expression
        | conditional_or_expression OR conditional_and_expression
          {
-//             $$ = new Binary (Binary.Operator.LogicalOr,
-//                              (Expression) $1, (Expression) $3, lexer.Location);
+               $$ = new Binary (Binary.Operator.BitwiseOr,
+                                (Expression) $1, (Expression) $3, lexer.Location);
          }
        | conditional_or_expression ORELSE conditional_and_expression
-         {     // FIXME: this is likely to be broken
+         {     
                $$ = new Binary (Binary.Operator.LogicalOrElse,
                                 (Expression) $1, (Expression) $3, lexer.Location);
          }