Author: manjula
Date: 2005-03-04 05:48:44 -0500 (Fri, 04 Mar 2005)
New Revision: 41432

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/assign.cs
   trunk/mcs/mbas/mb-parser.jay
Log:
        Support Mid Assignment Statement


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-03-04 10:32:17 UTC (rev 41431)
+++ trunk/mcs/mbas/ChangeLog    2005-03-04 10:48:44 UTC (rev 41432)
@@ -1,3 +1,8 @@
+2005-03-04 Manjula GHM <[EMAIL PROTECTED]>
+       * mb-parser.jay:
+       * assign.cs:
+               Support Mid Assignment Statement
+
 2004-12-01 Rafael Teixeira <[EMAIL PROTECTED]>
        * driver.cs: correcting the handling of many options. 
        * Upgraded to latest Mono.GetOptions that supports vbc style boolean 
arguments /debug+ /debug-, and /help2 to hide less used options

Modified: trunk/mcs/mbas/assign.cs
===================================================================
--- trunk/mcs/mbas/assign.cs    2005-03-04 10:32:17 UTC (rev 41431)
+++ trunk/mcs/mbas/assign.cs    2005-03-04 10:48:44 UTC (rev 41432)
@@ -4,6 +4,7 @@
 // Authors:
 //   Miguel de Icaza ([EMAIL PROTECTED])
 //   Martin Baulig ([EMAIL PROTECTED])
+//   Manjula GHM ([EMAIL PROTECTED])
 //
 // (C) 2001, 2002 Ximian, Inc.
 //
@@ -223,7 +224,41 @@
                        // local variable as source.
                        if (embedded != null)
                                source = (embedded.temp != null) ? 
embedded.temp : embedded.source;
+                       //To support 'Mid' Assignment Statement
+                       if(target is Invocation) {
 
+                        Invocation i = (Invocation) target;
+                        Expression mid_expr;
+                        mid_expr = i.Expr;
+
+                        if (mid_expr is SimpleName) {
+                                SimpleName sn = mid_expr as SimpleName;
+                                string s = sn.Name;
+                               
+                                if (s == "Mid" || s == "Mid$") {
+                       //It is Mid statement. Construct the function and 
+                       //call corresponding 
Microsoft.VisualBasic.CompilerServices function 
+                                       Expression etmp;
+                                       ArrayList arglist = new ArrayList();
+
+                                       Argument arg4;
+                                       Expression e = null;
+                                       eclass = ExprClass.Value;
+
+                                       arglist  = i.Arguments;
+
+                                       etmp = 
Mono.MonoBASIC.Parser.DecomposeQI("Microsoft.VisualBasic.CompilerServices.StringType.MidStmtStr",
 loc);
+                       //Get fourth argument and add it to argument list
+
+                                       arg4 = new Argument (source, 
Argument.AType.Expression);
+                                       arglist.Add (arg4);
+                                       e = (Expression) new Invocation (etmp, 
arglist, loc);
+                                       e = e.Resolve(ec);
+                                       return e;
+                               }
+                       }
+       
+               }
                        target = target.ResolveLValue (ec, source);
 
                        if (target == null)

Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay        2005-03-04 10:32:17 UTC (rev 41431)
+++ trunk/mcs/mbas/mb-parser.jay        2005-03-04 10:48:44 UTC (rev 41432)
@@ -4292,6 +4292,17 @@
                $$ = new Invocation ((Expression) $1, (ArrayList) $3, 
lexer.Location);
 //             Console.WriteLine ("Invocation: {0} with {1} arguments", $1, 
($3 != null) ? ((ArrayList) $3).Count : 0);
          }
+
+// To support Mid$()
+       | primary_expression DOLAR_SIGN OPEN_PARENS opt_argument_list 
CLOSE_PARENS
+         {
+               if ($1 == null) {
+                       Location l = lexer.Location;
+                       Report.Error (1, l, "THIS IS CRAZY");
+               }
+               $$ = new Invocation ((Expression) $1, (ArrayList) $4, 
lexer.Location);
+               // Console.WriteLine ("Invocation: {0} with {1} arguments", $1, 
($4 != null) ? ((ArrayList) $4).Count : 0);
+         }
        | CALL primary_expression OPEN_PARENS opt_argument_list CLOSE_PARENS
          {
                if ($2 == null) {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to