Browse Source

fixed some documentation related parser bug

Nicolas Cannasse 18 years ago
parent
commit
7b6e36d99d
2 changed files with 15 additions and 7 deletions
  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
 	fix with remoting threadserver and exceptions
 	fixed Flash9 dynamic runtime type field access
 	fixed Flash9 dynamic runtime type field access
 	fixed very tricky typing bug with constructors inheritance
 	fixed very tricky typing bug with constructors inheritance
+	fixed some documentation related parser bug
 
 
 2007-07-25: 1.14
 2007-07-25: 1.14
 	fixed no error when invalid "catch" expression
 	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
 		let e2 , s = (match s with parser
 			| [< '(Kwd Else,_); e2 = expr; s >] -> Some e2 , s
 			| [< '(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
 					None , s
 		) in
 		) in