Ver Fonte

fixed some documentation related parser bug

Nicolas Cannasse há 18 anos atrás
pai
commit
7b6e36d99d
2 ficheiros alterados com 15 adições e 7 exclusões
  1. 1 0
      doc/CHANGES.txt
  2. 14 7
      parser.ml

+ 1 - 0
doc/CHANGES.txt

@@ -19,6 +19,7 @@
 	fix with remoting threadserver and exceptions
 	fixed Flash9 dynamic runtime type field access
 	fixed very tricky typing bug with constructors inheritance
+	fixed some documentation related parser bug
 
 2007-07-25: 1.14
 	fixed no error when invalid "catch" expression

+ 14 - 7
parser.ml

@@ -528,13 +528,20 @@ and expr = parser
 		let e2 , s = (match s with parser
 			| [< '(Kwd Else,_); e2 = expr; s >] -> Some e2 , s
 			| [< >] ->
-				match Stream.npeek 2 s with
-				| [(Semicolon,_);(Kwd Else,_)] ->
-					Stream.junk s;
-					Stream.junk s;
-					(match s with parser
-					| [< e2 = expr; s >] -> Some e2, s
-					| [< >] -> serror())
+				(* 
+					we can't directly npeek 2 elements because this might
+					remove some documentation tag.
+				*)
+				match Stream.npeek 1 s with
+				| [(Semicolon,_)] ->
+					(match Stream.npeek 2 s with
+					| [(Semicolon,_); (Kwd Else,_)] ->
+						Stream.junk s;
+						Stream.junk s;
+						(match s with parser
+						| [< e2 = expr; s >] -> Some e2, s
+						| [< >] -> serror())
+					| _ -> None , s)
 				| _ ->
 					None , s
 		) in