[svn] r6035: nemerle/trunk/macros/core.n

malekith svnadmin at nemerle.org
Wed Dec 21 20:43:48 CET 2005


Log:
Lower 'in' priority again. Fix foreach. Still doesn't boot (quotations problems).

Author: malekith
Date: Wed Dec 21 20:43:48 2005
New Revision: 6035

Modified:
   nemerle/trunk/macros/core.n

Modified: nemerle/trunk/macros/core.n
==============================================================================
--- nemerle/trunk/macros/core.n	(original)
+++ nemerle/trunk/macros/core.n	Wed Dec 21 20:43:48 2005
@@ -50,7 +50,7 @@
 [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", "<<", false, 230, 231)]
 [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", ">>", false, 230, 231)]
 [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", "::", false, 221, 220)]
-[assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", "in", false, 215, 211)]
+[assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", "in", false, 120, 121)]
 [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", "as", false, 215, 301)]            
 [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", "<", false, 210, 211)]
 [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Core", ">", false, 210, 211)]
@@ -321,9 +321,18 @@
    * The 'foreach' macro introduces a construction equivalent
    * to C#'s 'foreach' keyword, iterating over a collection.
    */
-  macro @foreach (iter, collection, body)
-  syntax ("foreach", "(", iter, "in", collection, ")", body)
+  macro @foreach (inexpr, body)
+  syntax ("foreach", "(", inexpr, ")", body)
   {
+    def (iter, collection) =
+      match (inexpr) {
+        | <[ @in ($iter, $collection) ]> =>
+          (iter, collection)
+        | e =>
+          Message.FatalError ($ "the syntax is 'foreach (x in collection)', "
+                                "got $e");
+      }
+      
     def typer = Macros.ImplicitCTX ();
     def tcollection = typer.TypeExpr (collection);
 



More information about the svn mailing list