Beispiel #1
0
func (parser *Parser) parseExceptions(method *ast.Method) {

	token := parser.peek()

	if token.Type != lexer.KeyThrows {
		return
	}

	parser.next()

	parser.expectf(lexer.TokenType('('), "method exception table must start with (")

	for {

		typeDecl := parser.expectTypeDecl("expect exception type")

		exception := method.NewException(typeDecl)

		start, end := Pos(typeDecl)

		_setNodePos(exception, start, end)

		token := parser.peek()

		if token.Type != lexer.TokenType(',') {
			break
		}

		parser.next()
	}

	parser.expectf(lexer.TokenType(')'), "method exception table must end with )")
}