Commits

Toby Inkster committed 53d1660

Allow a block to exist as a statement.

  • Participants
  • Parent commits bad4003

Comments (0)

Files changed (1)

File lib/Java/Parser.pm

 
 	method parse_statement_body
 	{
-		if ($self->next_token_matches('.Keyword', 'assert'))
+		if ($self->next_token_matches('.LeftCurly')
+			{ return $self->parse_block }
+			
+		if ($self->next_token_matches('.Keyword', 'assert')) # TODO
 			{ return $self->parse_assert_statement }
 		
-		if ($self->next_token_matches('.Keyword', 'break'))
+		if ($self->next_token_matches('.Keyword', 'break')) # TODO
 			{ return $self->parse_break_statement }
 		
-		if ($self->next_token_matches('.Keyword', 'continue'))
+		if ($self->next_token_matches('.Keyword', 'continue')) # TODO
 			{ return $self->parse_continue_statement }
 
-		if ($self->next_token_matches('.Keyword', 'do'))
+		if ($self->next_token_matches('.Keyword', 'do')) # TODO
 			{ return $self->parse_do_statement }
 		
-		if ($self->next_token_matches('.Keyword', 'for'))
+		if ($self->next_token_matches('.Keyword', 'for')) # TODO
 			{ return $self->parse_for_statement }
 
 		if ($self->next_token_matches('.Keyword', 'if'))
 		if ($self->next_token_matches('.Keyword', 'return'))
 			{ return $self->parse_return_statement }
 
-		if ($self->next_token_matches('.Keyword', 'super'))
+		if ($self->next_token_matches('.Keyword', 'super')) # TODO
 			{ return $self->parse_super_statement }
 
-		if ($self->next_token_matches('.Keyword', 'switch'))
+		if ($self->next_token_matches('.Keyword', 'switch')) # TODO
 			{ return $self->parse_switch_statement }
 
-		if ($self->next_token_matches('.Keyword', 'throw'))
+		if ($self->next_token_matches('.Keyword', 'throw')) # TODO
 			{ return $self->parse_throw_statement }
 
 		if ($self->next_token_matches('.Keyword', 'try'))
 			{ return $self->parse_try_statement }
 
-		if ($self->next_token_matches('.Keyword', 'while'))
+		if ($self->next_token_matches('.Keyword', 'while')) # TODO
 			{ return $self->parse_while_statement }
 
 		try {
 		);
 }
 
+class Java::Ast::Statement
+	extends Java::Ast
+{
+	has label => (
+		is       => 'rw',
+		isa      => 'Str',
+		);
+}
+
 class Java::Ast::Block
-	extends Java::Ast
+	extends Java::Ast::Statement
 {
 	has statements => (
 		is       => 'rw',
 		);
 }
 
-class Java::Ast::Statement
-	extends Java::Ast
-{
-	has label => (
-		is       => 'rw',
-		isa      => 'Str',
-		);
-}
-
 class Java::Ast::Statement::Import
 	extends Java::Ast::Statement
 	with Java::Ast::WithModifiers