[svn] r7418: nemerle/trunk/ncc: parsing/PreParser.n testsuite/negative/parser.n testsuite/positive/generic...

nazgul svnadmin at nemerle.org
Tue Feb 13 21:33:37 CET 2007


Log:
Fix preparser to do not ignore unclosed braces

Author: nazgul
Date: Tue Feb 13 21:33:35 2007
New Revision: 7418

Modified:
   nemerle/trunk/ncc/parsing/PreParser.n
   nemerle/trunk/ncc/testsuite/negative/parser.n
   nemerle/trunk/ncc/testsuite/positive/generics.n

Modified: nemerle/trunk/ncc/parsing/PreParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/PreParser.n	(original)
+++ nemerle/trunk/ncc/parsing/PreParser.n	Tue Feb 13 21:33:35 2007
@@ -238,7 +238,7 @@
       }
     }
     
-    parse_brace_group (loc : Location) : Token.BracesGroup
+    parse_brace_group (loc : Location, expect_endbrace = true) : Token.BracesGroup
     {
       def parent_begin = parent_stream.Count;
       def current_begin = current_stream.Count;
@@ -259,7 +259,7 @@
             reset_comment (tok);
             finish_current (current_begin); loop ()
 
-          | Token.EndOfFile when parent_begin == 0 =>
+          | Token.EndOfFile when !expect_endbrace =>
             def brace_group = finish_parent (parent_begin, current_begin);
             finished = true;
             Token.BracesGroup (loc + tok.Location, brace_group);
@@ -576,7 +576,7 @@
     [Nemerle.Assertions.Ensures (value != null)]
     public PreParse () : Token.BracesGroup {
       try {
-        def top = parse_brace_group (lexer.Location);
+        def top = parse_brace_group (lexer.Location, false);
         unless (finished)
           Message.Error (lexer.Location, "expected end of file, encountered closing brace");
         top

Modified: nemerle/trunk/ncc/testsuite/negative/parser.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/parser.n	(original)
+++ nemerle/trunk/ncc/testsuite/negative/parser.n	Tue Feb 13 21:33:35 2007
@@ -30,3 +30,7 @@
   
 }
 
+module Unclosed { // E: when parsing this
+    foo () : void  {
+        
+    } // E: unexpected end of file
\ No newline at end of file

Modified: nemerle/trunk/ncc/testsuite/positive/generics.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/generics.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/generics.n	Tue Feb 13 21:33:35 2007
@@ -178,12 +178,6 @@
     } 
 }
 
-public module Bug888
-{
-  public Foo[T,S,U](_x : T) : void where S : T where U : S, T
-  {
-  }
-} 
 /*
 BEGIN-OUTPUT
 System.Collections.Generic.List`1[System.Int32]



More information about the svn mailing list