From ae905980e7cd01d3706613f6ca6c978f75f83d84 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 10 Jul 2008 20:50:38 -0700 Subject: [PATCH] - fixed bug in parser.go - added more tests SVN=126784 --- usr/gri/gosrc/parser.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); -- 2.48.1