[svn] r7242: nemerle/trunk/ncc/parsing/MainParser.n

IT svnadmin at nemerle.org
Thu Jan 11 00:38:43 CET 2007


Log:
Fixed VariantOption location.

Author: IT
Date: Thu Jan 11 00:38:42 2007
New Revision: 7242

Modified:
   nemerle/trunk/ncc/parsing/MainParser.n

Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n	(original)
+++ nemerle/trunk/ncc/parsing/MainParser.n	Thu Jan 11 00:38:42 2007
@@ -855,17 +855,17 @@
 
     parse_option (modifiers : Modifiers) : ClassMember
     {
-      def make_option (id : Splicable, children) {
+      def make_option (id : Splicable, children, loc) {
         if (in_variant) {
           def members =
             if (children != null)
               process_groups (children, "elements of variant option", ParseClassMember);
             else [];
-          def td = TopDeclaration.VariantOption (name = id, loc = id.Location,
+          def td = TopDeclaration.VariantOption (name = id, loc = loc,
                                                  modifiers = modifiers,
                                                  decls = members,
                                                  typarms = null);
-          ClassMember.TypeDeclaration (loc = id.loc, name = null, modifiers = null, td = td)
+          ClassMember.TypeDeclaration (loc = loc, name = null, modifiers = null, td = td)
         }
         else {
           when (children != null)
@@ -876,11 +876,11 @@
       
       def id = get_splicable_id ();
       match (peek_token ()) {
-        | Token.BracesGroup (children) =>
+        | Token.BracesGroup (children) as group =>
           shift ();
-          make_option (id, children)
+          make_option (id, children, id.Location + group.Location)
 
-        | Token.EndOfGroup => make_option (id, null)
+        | Token.EndOfGroup => make_option (id, null, id.Location)
         | Token.Operator ("=") =>
           shift ();
           def val = Some (parse_expr (TokenStoppers.Pipe));
@@ -889,7 +889,7 @@
 
         | _ =>
           new_group_beginning ();
-          make_option (id, null);
+          make_option (id, null, id.Location);
       }
     }
 



More information about the svn mailing list