From: Robert Griesemer Date: Fri, 11 Jul 2008 03:50:38 +0000 (-0700) Subject: - fixed bug in parser.go X-Git-Tag: weekly.2009-11-06~3521 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ae905980e7cd01d3706613f6ca6c978f75f83d84;p=gostls13.git - fixed bug in parser.go - added more tests SVN=126784 --- diff --git a/usr/gri/gosrc/parser.go b/usr/gri/gosrc/parser.go index 0e025f9d39..ecf7699ae0 100644 --- a/usr/gri/gosrc/parser.go +++ b/usr/gri/gosrc/parser.go @@ -592,10 +592,14 @@ func (P *Parser) ParseIfStat() { P.Trace("IfStat"); P.Expect(Scanner.IF); if P.tok != Scanner.LBRACE { - P.ParseSimpleStat(); + if P.tok != Scanner.SEMICOLON { + P.ParseSimpleStat(); + } if P.tok == Scanner.SEMICOLON { P.Next(); - P.ParseExpression(); + if P.tok != Scanner.LBRACE { + P.ParseExpression(); + } } } P.ParseBlock(); @@ -677,10 +681,14 @@ func (P *Parser) ParseSwitchStat() { P.Trace("SwitchStat"); P.Expect(Scanner.SWITCH); if P.tok != Scanner.LBRACE { - P.ParseSimpleStat(); + if P.tok != Scanner.SEMICOLON { + P.ParseSimpleStat(); + } if P.tok == Scanner.SEMICOLON { P.Next(); - P.ParseExpression(); + if P.tok != Scanner.LBRACE { + P.ParseExpression(); + } } } P.Expect(Scanner.LBRACE);